The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I have the following Tables
dim Date, Dim Group, Fact
DAX Expression
Solved! Go to Solution.
HI @DebbieE
ALLSELECTED() will preserve the filters coming from outside the visuals so the filters for year and group will still be applied.
If you are using date dimension in your model, then you should have a Month Column and use it and Month Sort Column in SUMMARIZE ( )
Please see my Measure and outcome below.
Ive managed to rejig my script using the above info thankyou
Hi @DebbieE
Try something like this.
Rank = VAR _tbl = SUMMARIZE( ALLSELECTED( yourFactTable ), 'dim Date'[date].[Month] , 'dim Group'[Group] ) RETURN RANKX( _tbl, [Avg Fact],, DESC, Dense )
Its not worked
And its not ranking the Percentages Correctly.
There are 2 other things Im doing that may be affecting it
1. There is a Slicer in the report on year 2019
2. There is visual filter selecting 3 groups, so some groups are missing.
Im begining to worry that I cant do this in DAX
Hi @DebbieE
Can you create and share a data sample?
Many Thanks
Unfortunately not, The way this form works , I cant share data from our One Drive
HI @DebbieE
Try the below.
Rank = IF( NOT ISBLANK( [Avg Fact] ), VAR _tbl = CALCULATETABLE( VALUES( 'dim Date'[date].[Month] ), ALLSELECTED() ) RETURN RANKX( _tbl, [Avg Fact],, DESC, Dense ) )
Its got rid of the rank against null which is great but all the ranks are 1
So what I want is for Plan Jan = 1, Feb = 3 , March = 2
Again, Ive got a filter on Group so it only choses those 3 groups and a Slicer on Year
Hi @DebbieE
Try the below, or if your original measure worked fine, just add IF( NOT ISBLANK( [Avg Fact] ), Your Measure )
Measure = Rank = IF( NOT ISBLANK( [Avg Fact] ), VAR _tbl = CALCULATETABLE( SUMMARIZE( 'dim Date', 'dim Date'[MonthColumn], 'dim Date'[MonthSortColumn] ), ALLSELECTED() ) RETURN RANKX( _tbl, [Avg Fact],, DESC, Dense ) )
Im unsure where the month sort column has come from ?
Im using Month from the date hierarchy
Ive tried the following but it just sets everything as 1
HI @DebbieE
ALLSELECTED() will preserve the filters coming from outside the visuals so the filters for year and group will still be applied.
If you are using date dimension in your model, then you should have a Month Column and use it and Month Sort Column in SUMMARIZE ( )
Please see my Measure and outcome below.
Ive managed to rejig my script using the above info thankyou
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
106 | |
77 | |
72 | |
47 | |
39 |
User | Count |
---|---|
138 | |
108 | |
69 | |
64 | |
57 |