dax

Power BI: how to merge specific tables

空扰寡人 提交于 2021-01-01 14:34:51
问题 I have Table A with data of specific people doing their tasks like this: I have Table B with data of needs for specific people for different periods of time like this: I also have additional table C with period definitions: Period no | Date from | Date to -------------------------------------- 1 | 27/01/2021 | 24/02/2021 2 | 25/02/2021 | 24/03/2021 ... There are 2 problems here: Someone in Table A can have Start and End dates spanning multiple periods, like for example Human B The Start and

Power BI: how to merge specific tables

主宰稳场 提交于 2021-01-01 14:33:45
问题 I have Table A with data of specific people doing their tasks like this: I have Table B with data of needs for specific people for different periods of time like this: I also have additional table C with period definitions: Period no | Date from | Date to -------------------------------------- 1 | 27/01/2021 | 24/02/2021 2 | 25/02/2021 | 24/03/2021 ... There are 2 problems here: Someone in Table A can have Start and End dates spanning multiple periods, like for example Human B The Start and

Power BI: how to merge specific tables

。_饼干妹妹 提交于 2021-01-01 14:33:11
问题 I have Table A with data of specific people doing their tasks like this: I have Table B with data of needs for specific people for different periods of time like this: I also have additional table C with period definitions: Period no | Date from | Date to -------------------------------------- 1 | 27/01/2021 | 24/02/2021 2 | 25/02/2021 | 24/03/2021 ... There are 2 problems here: Someone in Table A can have Start and End dates spanning multiple periods, like for example Human B The Start and

ASC parameter when using TOPN function in Power BI

吃可爱长大的小学妹 提交于 2021-01-01 06:28:50
问题 I've got this data: Then have this measure: amount = SUM( play[amount] ) Then I've tried to use the ASC/DESC arguments of the TOPN function in these two measures: Top 2 customer per category ASC = VAR rnk = VALUES( play[customer] ) RETURN CALCULATE( [amount], TOPN( 2, ALL( play[customer] ), [amount], ASC ), RNK ) Top 2 customer per category DESC = VAR rnk = VALUES( play[customer] ) RETURN CALCULATE( [amount], TOPN( 2, ALL( play[customer] ), [amount], DESC ), RNK ) Now if I use these two

ASC parameter when using TOPN function in Power BI

拈花ヽ惹草 提交于 2021-01-01 06:28:39
问题 I've got this data: Then have this measure: amount = SUM( play[amount] ) Then I've tried to use the ASC/DESC arguments of the TOPN function in these two measures: Top 2 customer per category ASC = VAR rnk = VALUES( play[customer] ) RETURN CALCULATE( [amount], TOPN( 2, ALL( play[customer] ), [amount], ASC ), RNK ) Top 2 customer per category DESC = VAR rnk = VALUES( play[customer] ) RETURN CALCULATE( [amount], TOPN( 2, ALL( play[customer] ), [amount], DESC ), RNK ) Now if I use these two

Converting Case statement, Filter from t-SQL query to DAX

半城伤御伤魂 提交于 2020-12-15 07:13:35
问题 I have a problem converting below t-sql query into DAX. Overview - There are two sample tables - Table1 and Table2 with below schema Table1 (ID varchar(20),Name varchar(30)) Table2 (CapID varchar(20),CAPName varchar(30), CapID_Final varchar(20)) Please note : There exists one to many relationship between above tables : [ID] in Table2 with [CapID] in Table1 I am trying to derive CapID_Final column in table2 based on conditions as per my t-SQL query in below which works perfectly fine - SELECT

Converting Case statement, Filter from t-SQL query to DAX

…衆ロ難τιáo~ 提交于 2020-12-15 07:12:29
问题 I have a problem converting below t-sql query into DAX. Overview - There are two sample tables - Table1 and Table2 with below schema Table1 (ID varchar(20),Name varchar(30)) Table2 (CapID varchar(20),CAPName varchar(30), CapID_Final varchar(20)) Please note : There exists one to many relationship between above tables : [ID] in Table2 with [CapID] in Table1 I am trying to derive CapID_Final column in table2 based on conditions as per my t-SQL query in below which works perfectly fine - SELECT

PowerBI. Two apparently equal calculated measures are actually different. why?

自古美人都是妖i 提交于 2020-12-15 05:32:40
问题 I end up with the following two calculated measures in Power BI which look semantically equal, but each produces a different result. I'd like to understand why. How does Power BI calculate each so they produce different results? measure1 = VAR var1 = CALCULATE ( [measure], table[column_1] = "some value in column 1" ) VAR var2 = CALCULATE ( var1, table[column_2] = "some value in column 2" ) RETURN var2 Literally, copy the RHS of var1 into its value in var2. measure2 = VAR var2 = CALCULATE (

Add Index without unique values - Power BI / DAX / M

大憨熊 提交于 2020-12-15 05:03:40
问题 I have a column with Countries (in a table, the column have duplicates) and I need to order them with a index: Countries, Desirable index A 1 B 2 B 2 C 3 D 4 D 4 E 5 I can't remove the duplicates because I need the other columns for reference thanks 回答1: Create a table of only distinct countries, index that table, then merge/join that table back to your existing table (the one with duplicates) and expand the index column you just created. 来源: https://stackoverflow.com/questions/65145128/add

PowerBI: How to get distinct count for a column in a table, while grouping for many columns separately

你离开我真会死。 提交于 2020-12-12 01:55:16
问题 I have a table with multiple date columns, and a single label column, as shown by following code Data = DATATABLE ( "Date1", DATETIME, "Date2", DATETIME, "Label", STRING, { { "2020-01-01","2020-01-02", "A" }, { "2020-01-01","2020-01-01", "A" }, { "2020-01-01","2020-01-02", "B" }, { "2020-01-01","2020-01-01", "D" }, { "2020-01-01","2020-01-02", "E" }, { "2020-01-02","2020-01-01", "A" }, { "2020-01-02","2020-01-02", "B" }, { "2020-01-02","2020-01-01", "C" } } ) I want to plot a chart of count