Quantcast
Channel: Power Query topics
Viewing all 31556 articles
Browse latest View live

Remove all columns of a particular type except one

$
0
0

Question:
I am trying to remove all columns of a particular type with the exception of 1. I already know how to dynamically remove all the columns of a type, but i cant figure out how to exclude one of them. So in other words, remove all columns of type table or record except TRANSACTION_LINES.

 

Table.RemoveColumns(TRANSACTIONS_Table, Table.ColumnsOfType(TRANSACTIONS_Table, {type record, type table}))

 

This is what im using for the removal all columns of those types, just need to figure out how to not remove TRANSACTION_LINES which is a type of table.

 

I know im close but im totally stumped.


Ignore Page Filter on One table view and apply one second table view in a Single Page

$
0
0

Hi,

Please help me with the below requirement. 

 

I have two table views of the same data set. However, one table should work with a page filter, and another table should show all the data. Trying to figure All Expect measure but no luck.

 

Note: I am using Power BI Data Set as my source. So I cant create multiple tables, I cant create columns.

 

Dataset:

PhonesCategory
Iphone6No Demand
Iphone7Demand
Iphone8Demand
Iphone9No Demand
Iphone10Demand
Iphone11Demand

 

Result:

Capture.PNG

Only query new records

$
0
0

Hello, all! 

 

I have a dataset pulled from a number of xml files in an Azure blob.   In that dataset are some IP addresses that I am querying location data for using a web API.  A lot of IP addresses, really, and that's part of the issue.  It's pretty wasteful to query all of these addresses again on a refresh so I'm trying to figure out a way to keep the results of the previous query. 

 

I have my function that queries the data using the API.  I copied all of the results to a manual (archive) table and then modified my function to check the archive table to see if that IP address exists.  If so, I use the data from the archive table, if not I query the data via the API. 

 

This works okay, until I try to add new results to that archive table.  I've not been successful in adding data to the archive table without creating some sort of issue with Power BI as it's a pretty cyclical situation:  a check to see if a record exists in the archive table is made, it's false so the web api is queried.  But, if that record is added to the archive table somehow then the check would be true...   Power BI doesn't seem to be handling what I'm trying to do well which means I'm not doing it right, as far as Power BI is concerned...  

 

Does anyone have any suggestions as to how to handle this?   Basically, I'm trying to have persistent table that I can add rows to if there isn't already a matching record.

Table of Lists - Are all List Values in Another List

$
0
0

Hi all, I have a table that contains many fields, one of which is List of Orders. This contains a list, where each value is an order. So for example:

msmays5_0-1600373522904.png

 

And the lists might look like

List 1: {"A", "B"}

List 2: {"C"}

List 3: {"A", "B", "D"}

List 4: {"A", "B", "E"}

List 5: {"C", "D"}

 

I'd like to add a column [Resubmitted Orders] that says, for each list in [List of Orders], determine if ALL the orders in that list are in another single list. So for the above, List 1 and List 2 would both be TRUE because all of the values in List 1 are in List 3/List 4, and all of the values in List 2 are in List 5.

 

Thanks in advance for all of your help!

 

 

How to use machine learning/ Python in Azure analysis services ?

$
0
0

We are using Azure Analysis Services with our model which is directly connected to Power Bi Desktop. 

 

But i am facing the following issue :

1. I'm not able to use Python with azure analysis services 

2. How can i use Machine leaning with python for azure analysis services 

3. I'm not able to use Power query with azure analysis services where i could use Python earlier 

 

So in short i want to know how can i use Machine leaning with python for azure analysis services ?
Thanx in advance 

Single Cell Duplicates Removal

$
0
0

please support with a solution for the below issue, i have column Data as below, i need the result to be as illustarted

 

DataResult
1-2-1-3-11-2-3
4-1-3-4-5-51-3-4-5

Json.FromValue encoding special characters

$
0
0

Hi - I am using the following formula to create some JSON:

 

Text.FromBinary(Json.FromValue(
[domain=[company.domain],
companyName=[company.company],
speakerName=[speaker.title],
speakerTitle=[speaker.roles.job_title],
speakerCompany=[speaker.roles.company_name],
speakerImageURL=[speaker.thumbnail],
speakerURL=[speaker.permalink],
sessions={[sessions]}]))

 

But special characters get encoded e.g. Damsgård is contained in the column data but gets encoded to Damsg\u00e5rd in the JSON. I've tried using UTF8 encoding value etc.

 

How can I stop this or change these back to the actual characters? Note I don't know how many cases of this there are in the data so an individual find & replace is not ideal.

Power BI - Power Query map to Entity

$
0
0

Hi,

 

Id' like to write te results of my Power Query in Power BI to a new entity in CDS (map to entity)

remconicolai_0-1600417844955.png

What I see is a list of standard entities in a CDM environment but these entities doesn't match te results of my Power query so I want to cerate a new entity in this enviroment. It seems possible because when I open a workspace I can select the option 'Add entities'

remconicolai_1-1600418082200.png

 

If i continue to add a new entity in the Common Data Service, I have to select a server URL. 

My question is, what is the server URL for the CDM model I see in Power BI? Or do I have to choose another way to resolve this?

 

remconicolai_2-1600418203270.png

 

 


Change the Excel source to an azure blob storage

$
0
0

Hi guys,

you can change the source in the Power Query from an Excel file to an Azure Blob storage. The structure remains exactly the same - only the source changes?

 

thanks in advance

greetings lukas

DAX formula for calculating diff date of consecutive rows

$
0
0

Hi, 

 

I'm new to DAX and I need your help.

 

I have the following table:

 

device_idtimedisplay_timeCalculate
AA9/10/2020 01:029/10/2020 01:0200:01:00
AA9/10/2020 13:059/10/2020 01:0500:03:34
AA9/10/2020 01:069/10/2020 01:0600:00:41
AA9/10/2020 13:099/10/2020 13:0912:03:34
BB9/11/2020 00:289/11/2020 00:28 00:01:00
BB9/11/2020 12:309/11/2020 12:3012:02:16
BB9/11/2020 00:329/11/2020 12:3200:02:37
BB9/11/2020 12:359/11/2020 12:3500:02:15
CC9/10/2020 09:599/10/2020 09:59 00:01:00
CC9/10/2020 22:019/10/2020 22:0112:01:30
CC9/10/2020 10:039/10/2020 22:0300:02:14
CC9/10/2020 22:059/10/2020 22:0500:02:07

 

madalin_0-1600383491691.png

 

I want to calculate de difference in seconds between two consecutive display times for a device( like in the Calculate column) and if it's possible for the first display_time for a device to insert a value e.g. 60 seconds.

 

I've tried adding first an index column and after that using the DATEDIFF formula but I can't properly sort the table and get right the consecutive values for display_time when I used an Index column.

 

 

Kind regards,

Madalin

 

 

 

Custom column - IF statements within date interval

$
0
0

Hello everyone! I have an ecommerce order table with data that looks like below:

 

Date  EmailHomeloanSales valueNew column (converted)
2020-01-01john@doe.comYes0Yes
2020-01-20john@doe.comNo150 
2020-01-01jane@doe.comYes0No
2020-05-20jane@doe.comNo150 

 

I want to add a custom column (marked in red) in power query that calculates if a "Homeloan" is converted or not.

 

Conversion rule: A homeloan is converted if a purchase (sales value >0) is made within 30 days from homeloan-order (email can be used as common denominator). As per above, first homeloan is converted (purchase made within a month), second one is not.

 

Thanks in advance!!

 

Getting similarly named tables from PDF files using folder connector

$
0
0

I need to combine multiple similarly structured PDF file tables into one data set. Normally I would just use the Folder connector option from get data however I am having a problem.

The PDF table ID changes from file to file and the auto generated M Code hard codes the table ID as part of it's routine so that it looks for the same table ID in every single file:

 

BlueNote_0-1600448312502.png

BlueNote_1-1600448364277.png

BlueNote_2-1600448434946.png

I am thinking that my M coding skills are just too weak and there must be a solution using some sort of custom M Code for this. I am grateful for any help.

 

The source files are provided to my company from a consultant and they won't give us the backup data so I'd like to use PowerQuery's PDF connector to combine each quarterly file so we can get multiple period reporting and make our own custom reports etc. The data is very confidential so I can't provide the files and I can't make an example file because I don't have the original backup files to generate the PDF.

Reset count of ID once they've all been seen, count how many days it took then reset until next time

$
0
0

Hi,

 

I have 1500 unique IDs, everyday many are seen and some multiple times a day.

 

I would like to do a cumulative count and know how many days does it takes to see them all 1500, once it reaches that amount, the cumulative sum needs to reset for another count until the next time the goal is met.

 

I've done a running total after a grouped count by date, but my issue aside from the needed reset is that the duplicates needs to be removed based on the time period needed to attain the goal. If i'm grouping my IDs by date then i'm losing the ability to sort out duplicates...

 

So i'm guessing I need to first find how much time is needed, then remove the duplicates from a custom column spanning over its own run tower the goal, and then, calculate the running...

 

Here's an ugly paint mockup of what i'd like my final result to look like (I realize I need my date format to be date.time otherwise i'll never get a correct goal and it'll be tricky)

Kiwizqt_0-1600449194030.png

 

 

I've found this solution here from Lind25 but the syntax is wrong, maybe from a previous PQ version:

https://community.powerbi.com/t5/Desktop/Running-total-that-resets-when-equal-to-or-greater-than-a-set/td-p/367214/page/2

 

 

let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content], AddedIndex = Table.AddIndexColumn(Source, "Index", 1, 1), #"Added Custom" = Table.AddColumn(AddedIndex, "Running total reset", each List.Accumulate(List.FirstN(AddedIndex[Difference],[Index]),0,(state,current)=>if state+current > 60 then 0 else state+current)) in #"Added Custom"

 

 

 

Any takers ? I'm completely lost on that one...

 

Thanks

 

Unpivoting Variable Number of Columns

$
0
0

Hello,

 

My dataset is an Excel file that is generated by a very inflexible program.  In order to make functional tables, I need to unpivot the columns.  My problem is that the number of columns in the Excel file changes every time the file is generated.

 

My data looks like this:

Date | Property | Product 1 | Product 2 | Product 3 .......

 

When I unpivot the Product columns the formula is:

= Table.Unpivot(#"Changed Type", {"Product 1", "Product 2", "Product 3", .... }

 

How can I change the function to unpivot all columns from column #3 up to (and including) the last column?

 

Thanks!

MS Forms Pro "Customer Voice" Connector

$
0
0

Ive look at the solutions for connection Form/Forms Pro but none of these solutions seem to work now that the service has changed to "Customer Voice".

 

Has anyone been able to easily connect the data into Power BI?


Very basic, when use # ? (M language)

$
0
0

Hi, I read documentation but can't find explanation for what mean # and when I need to use it. I se its use for variable name with space... but I saw more this symbol in code something like #date() I suspect what its use for data type... but I can't find some explanation, can you help me with some link to doc?

Non tabular Excel report to formatted table

$
0
0

I get daily sales reports from multiple branches in Excel but in a reporting format that is not a standard table. Basically it's a page layout that looks good for printing but is useless as it is for data manipulation in Excel or PowerBI. 

 

I'm looking for a way to automate this so that I don't have to do this manually for every single branch, every single day.

 

Is there a way to convert this kind of data to a standard table? All the formatting is the same everyday, all the same information is in the same cells, I just don't know how to convert that to a table that I can then use for further work.

 

I'm not a VBA programmer so I'm sure there's a way to do this via VBA. I'm wondering if there's a way to do this with Power Query.

Wrong releationship of Table values

$
0
0

Hi everybody,

 

I am facing following issue: I have two tables (see below Table A and Table B) and I want to display the relation of the columns FC and Cat. The releation is given over the the column LookUp. The problem is that for every Cat the matrix is showing me the relation to the very first value of the column FC.

Current result

CatFC
ETS_ABAA
ETS_ETKA
ETS_KKKA
ETS_ABAA
ETS_OIIA
ETS_KKJA

 

Expected Result

 

CatFC
ETS_ABAA
ETS_ETKA
ETS_KKKC
ETS_ABAB
ETS_OIIC
ETS_KKJD

 

Table A

CatLookUp
ETS_ABAFID_1
ETS_ETKFID_1
ETS_KKKFID_3
ETS_ABAFID_2
ETS_OIIFID_3
ETS_KKJFID_4

 

Table B

LookUp AFC
FID_1A
FID_1A
FID_3C
FID_2B
FID_3C
FID_4D

 

 

 

 

Need help to get the conditional average in power query

$
0
0

Hi,

I am a newbie to PowerQuery. I need a M Query solution to the below problem

Suppose I have a Country column, Value column. Now I wanted to average the Value column not equal to 0, for each country in the country column.  Kindly see the below example.

anvikuttu_0-1600515234584.png

 

Let me know if you have any questions.

 

Thank you...

Vj

Power Query: Include all unique columns found in files from folder

$
0
0

I've recently run into an issue which hopefully is solvable.

Currently, I have power query pointing at a folder containing several CSV files. This is normally no issue, however, in this instance not all of the files have the same columns.

Is there a way to have power query return every unique column found in the folder populating empty data observations with null values?

Assume that my folder has csv files similar to the following (note that the rows are indexed using letters for easy reference):

 

PIC1.png

 

I would like the final table to look something like:

 

PIC2.png

 

This seems like it should be pretty simple, but I can't figure it out for the life of me! Any help would be greatly appreciated!

Viewing all 31556 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>