Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi everyone, I have the following data (with abstract ficticious data) from a log book;
I want 2 things:
1. I want to add a group to each row specifying what group that Dimension belongs in, based on its last status; but only when the last status is 2 or 3! So when the last status is 2, the entire dimension should be grouped as "2" on every row. If the last status is 4, then Group should be blank.
2. Time 3 is basically AVERAGEX(Time1-Time2). The total average substracts Time2 from Time1 and then divides it by the number of rows, even by a row that has 0. I want to create a measure that results in the total average of (17,5+6+0)/2=11,75 or (2+0)/1=2 (example for dimensions A and B).
Please advise.
Solved! Go to Solution.
Hi @Paulien1989
You may add an index column in query editor first. Then you may get the group and Time3_Total with below measures. Here is the sample file for your reference.
1.
LastIndex = CALCULATE(MAX(Table1[Index]),ALLEXCEPT(Table1,Table1[Dimension]))
LastStatus = CALCULATE ( MAX ( Table1[Status] ), FILTER ( ALLEXCEPT ( Table1, Table1[Dimension] ), Table1[Index] = [LastIndex] ) )
Group = IF([LastStatus]=3||[LastStatus]=2,[LastStatus])
2.
Time3 = CALCULATE(SUM(Table1[Time1])-SUM(Table1[Time2]))
Count = CALCULATE ( COUNTROWS ( Table1 ), FILTER ( ALLEXCEPT ( Table1, Table1[Dimension] ), [Time3] <> 0 ) )
Time3_Total = IF ( HASONEFILTER ( Table1[Time1] ), [Time3], [Time3] / [Count] )
Regards,
Cherie
Hi @Paulien1989
You may add an index column in query editor first. Then you may get the group and Time3_Total with below measures. Here is the sample file for your reference.
1.
LastIndex = CALCULATE(MAX(Table1[Index]),ALLEXCEPT(Table1,Table1[Dimension]))
LastStatus = CALCULATE ( MAX ( Table1[Status] ), FILTER ( ALLEXCEPT ( Table1, Table1[Dimension] ), Table1[Index] = [LastIndex] ) )
Group = IF([LastStatus]=3||[LastStatus]=2,[LastStatus])
2.
Time3 = CALCULATE(SUM(Table1[Time1])-SUM(Table1[Time2]))
Count = CALCULATE ( COUNTROWS ( Table1 ), FILTER ( ALLEXCEPT ( Table1, Table1[Dimension] ), [Time3] <> 0 ) )
Time3_Total = IF ( HASONEFILTER ( Table1[Time1] ), [Time3], [Time3] / [Count] )
Regards,
Cherie
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
100 | |
78 | |
76 | |
52 |
User | Count |
---|---|
144 | |
109 | |
108 | |
88 | |
61 |