Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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