The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hi everyone!
My data set looks like this in PBI. Run_Type (Versions) in picture below goes up to 3, but in reality there's going to be many more different run_types (Versions).
I am looking to select any two different run_types in the two independent slicers I have created and be able to easily compare the KPIs between the two run_types, as well as having a column for % difference. So, the desired matrix would look something like this. I wnt to ensure also that Run_Type A is always before Run_Type B in the matrix.
I am really stuck. Any help on this would be greatly appreciated!
Thanks!
Solved! Go to Solution.
Hi @Raptors2019 ,
I create a table as you mentioned.
Then I add a slicer and a matrix into the visual page.
Next I create a measure and put it into the matrix.
Measure =
VAR _currentType =
MAX ( 'Table'[Run_Type] )
VAR _PreviousType =
CALCULATE (
MAX ( 'Table'[Run_Type] ),
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Run_Type] < _currentType )
)
VAR _currentDes =
SELECTEDVALUE ( 'Table'[Destination] )
VAR _current =
CALCULATE (
SUM ( 'Table'[Total Cost] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Destination] = _currentDes
&& 'Table'[Run_Type] = _currentType
)
)
VAR _previous =
CALCULATE (
SUM ( 'Table'[Total Cost] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Destination] = _currentDes
&& 'Table'[Run_Type] = _PreviousType
)
)
RETURN
IF ( _previous <> BLANK (), ABS ( _current - _previous ) )
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Raptors2019 ,
I create a table as you mentioned.
Then I add a slicer and a matrix into the visual page.
Next I create a measure and put it into the matrix.
Measure =
VAR _currentType =
MAX ( 'Table'[Run_Type] )
VAR _PreviousType =
CALCULATE (
MAX ( 'Table'[Run_Type] ),
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Run_Type] < _currentType )
)
VAR _currentDes =
SELECTEDVALUE ( 'Table'[Destination] )
VAR _current =
CALCULATE (
SUM ( 'Table'[Total Cost] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Destination] = _currentDes
&& 'Table'[Run_Type] = _currentType
)
)
VAR _previous =
CALCULATE (
SUM ( 'Table'[Total Cost] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Destination] = _currentDes
&& 'Table'[Run_Type] = _PreviousType
)
)
RETURN
IF ( _previous <> BLANK (), ABS ( _current - _previous ) )
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello @Raptors2019 , remember to adhere to the decorum of the Community Forum when asking a question.
Please provide your work-in-progress Power BI Desktop file (with sensitive information removed) that covers your issue or question completely in a usable format (not as a screenshot).
https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.
https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...
This allows members of the Forum to assess the state of the model, report layer, relationships, and any DAX applied.
Thank you for the feedback! It's my first time posting so did not know! I don't feel comfortable sharing the Power Bi as it has all sensitive info. In fact, the charts I shared is all made up data I created in order to be able to post this question.
User | Count |
---|---|
15 | |
12 | |
8 | |
7 | |
7 |
User | Count |
---|---|
24 | |
21 | |
12 | |
10 | |
7 |