Index column only for specific value (Conditional index column)
Re: Power BI taking ages to apply query changes
it's quite a journey before you
this topic has lots of sources:
https://community.powerbi.com/t5/Desktop/Good-Source-to-Learn-DAX/m-p/537748
here is an example for the cumulative totals:
https://www.daxpatterns.com/cumulative-total/
regarding your particular model it would be better to revisit once you learn the basic concepts, especially if you come from SQL background - DAX has very different way of solving same problems
if you're under time pressure though here are few tips:
1) instead of quarters as text I'd use dates (e.g. 2019-01-01 for 2019Q1, 2019-04-01 for 2019Q2). This enables using more operators, as well as gives access to the time intelligence functions
2) build a separate Calendar (date dimension) table (for the benefit of time intelligence):
https://www.sqlbi.com/articles/automatic-time-intelligence-in-power-bi/
https://docs.microsoft.com/en-us/power-bi/desktop-date-tables
3) if the baseline scenario is just prior year figures you could calculate these values based on Actual & Calendar table (e.g. using SAMEPERIODLASTYEAR)
https://docs.microsoft.com/en-us/dax/sameperiodlastyear-function-dax
Re: Trying to extract files from ZIP
Hello, I am having the same issue using the same MarkWhite function, with the exceptions of xlsx files. Once I get past this hurdle, each file within the zip file has same name, and then each file has 4 unique tab names. Will I be able to filter and extract same as a single file? Appreciate advice and a solution. Thanks!
Re: Last n days regardless of year
Hi
aha, I think I've understand you wrong.
Do you want to have something like requesting all birthdays in the last 7 days? So you don't care about the year part of the date?
Example:
IsInTheLast7Days(11.07.2019) = YES
IsInTheLast7Days(10.07.2018) = YES
IsInTheLast7Days(01.07.2019) = NO
Re: Faster append query
If I do this, it will make working on this much easier for me, but I don't think that I can deliver a tool to my coworkers that takes 45 min to load the first time that they use it or change the parameters of filter in the Excel sheet (the information in those querries is liable to change somewhat regularly so they will need to be updated).
What I think I need is some way to tell which steps are running client side. I know of the trick where you right click on the step in the query and see if the "view native query" is greyed out or not, but unfortunately I don't think that it will work for me 100% of the time.
I have a step in several queries where I group by and then use a function like "List.Mode" or "List.StandardDeviation" which are functions that aren't supported in the User Interface. These steps are always greyed out when I try to "View Native Code" and I think the reason is that the UI doesn't support those functions.
Is there any way to get a report of how much time each query takes to load? So for example, I could hit "refresh all" before I leave for the evening and return the next morning to see which subqueries needed how much time to refresh? Is there a way to break down that information into the steps within each subquery?
I don't think that your solution is a silver bullet, but thanks very much Maggie.
Best wishes,
MannyZ
Re: Nested table issue with TransformColumns
Hi
are you sure, that this property with value2 is correct? The prop1, prop2, and prop3 have just one text value for value2, but in prop4 it is an object. And that is also the problem why the xml file isn't parsed.
<property><name>prop4</name><subprop><value1>400</value1><value2><value3>ooo1</value3><value4>ooo2</value4></value2></subprop></property>
Using SAP BW OLEDB provider
Hi everybody!
I have an Excel file (32 bit) connected to the SAP BW instance via SAP BW OLE DB Provider.
I'm trying to establish the same connection in PBI Desktop (on the same PC), using the same connetion string (Provider=MDrmSap.2;Data Source=TNP;Location="";Mode=Read;Extended Properties="SFC_CLIENT=100;";Initial Catalog=Z05M04;MDX Compatibility=1).
But in PBI Desktopx64 I have a message that "Provider MDrmSAP.2 does not registerid on this PC"
And in PBI Desktopx32 - "OleDb.DataSource does not currently support multidimensional data sources"
Any Ideas?
Thank you in advance!
Re: Index column only for specific value (Conditional index column)
Hi
I have a solution for you. Click through the steps and you will see how it works.
I create an index on the original table. Then I create a second table "KeywordRowFullIndex" which contains only "Keyword" rows and create a secondary index on this smaller table. And in the end I join them together on the FullIndex.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8k6tLM8vSlGK1YlWCkmtKFEwVACBGgWEiBFEBCyAodwYSRIsYIIuYIpPuxlMMhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t]), IndexColumn = Table.AddIndexColumn(Source, "FullIndex", 0, 1), KeywordRowFullIndex = Table.SelectRows(IndexColumn, each [Column1] = "Keyword"), SecondaryIndex = Table.AddIndexColumn(KeywordRowFullIndex, "Index", 1, 1), Join = Table.NestedJoin(IndexColumn, "FullIndex", SecondaryIndex, "FullIndex", "SecondaryIndex"), ExpandedSecondaryIndex = Table.ExpandTableColumn(Join, "SecondaryIndex", {"Index"}, {"Index"}), RemoveFullIndexColumn = Table.RemoveColumns(ExpandedSecondaryIndex,{"FullIndex"}) in RemoveFullIndexColumn
Re: Is it possible to have an If function in another If function
Hi
jop, it is possible. Just add a new column in PowerQuery Editor UI and rewrite your many ifs. A documentation for IF can be found here: https://docs.microsoft.com/en-us/powerquery-m/expressions-values-and-let-expression#If
Re: Index column only for specific value (Conditional index column)
Hi Nolock,
Thank you very much for your code, which also provides the index in those rows with the keyword. But unfortunately a lot of rows are deleted in the end, almost every second. Do you have any idea why that is?
Google Analytics Error 403 (failed reporting requests is too high)
Need to substract production of a same product at different dates
Hi, I need to substract the inital production and the final production of one product at different years,
For example for the product AK01 need to substract the production (WOPT) at the last date of 2019 - the production (WOPT) at the fist date of 2019, the I have to do the same for 2020, 2021 2022 ... The table has other products and I have to do the same thing for each product
How to Fix Data Does not Line up with Header
When I export a flat data file to Excel, the headers in Excel are shifted exactly one column to the right of the from the underlying data in the columns. Here is a clip of the export file with some arrows showing the malignment:
Is there a transformation/process that can be used on a single row to push the headers over the right columns of data or is this a lost cause? There is so much else wrong with the file but I can fix those issues.
Please help, Almighty Datanaught Community!
Re: How to Fix Data Does not Line up with Header
Renaming your columns like so shoud do the job:
= Table.RenameColumns(Source, List.Select(List.Zip({Table.ColumnNames(Source), {""} & Table.ColumnNames(Source)}), each _{0} <> null))
Just replace "Source" by a reference to your table if needed.
Re: Index column only for specific value (Conditional index column)
Hi
no spontanious idea. Please, can you provide some sample data where it doesn't work?
Re: Nested table issue with TransformColumns
Hi
maybe I was wrong with the example.
this is how it looks like:
and expected transformation: name1=value1;name2=value2;name3=value3;......
Thank you for your help,
Best regards,
Zefi
Re: Finding First Name or Last name using DAX like @Username
USERNAME() has the domain as a prefix, do you account for that in your table?
https://docs.microsoft.com/en-us/dax/username-function-dax
you can also try with USERPRINCIPALNAME()
https://dax.guide/userprincipalname/
Proud to be a Datanaut!
Re: What is the best way to apply Nested Relationship same as SQL Statements?
I assume that the table you attached is what you want your visual look like, correct?
Do you need to prepare such table for single customer (1067) or multiple customers?
I'd start with the following:
1) put Carriers[Name] in the rows of the table visual
2) create first measure - Bookings
Bookings = COUNTROWS('TplBookings')
and put in the visual from 2)
You should now see all the carriers and number of rows from the TplBookings that is related to them
now if you want to limit it to a single customer you can either filter in the visual by the customer name (e.g. by using slicer) or hardcode it in CALCULATE (in this case you need single measure for each customer if you need to show more, in that case it's better to use the slicer)
Bookings = CALCULATE( COUNTROWS('TplBookings'), 'Invoices'[CustomerID] = 1067)
3) continue with the other measures using DAX
Re: Pseudo code
that's not really how PowerBi works
what's your input, and what's your intended output?
please post it as tables, following the instructions here:
Query Editor - Using query to form other data sets
How can I use C to make D and E? Many thanks!
Sincerely,
Patrick