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 August 31st. Request your voucher.
I have this field measure:
Works perfectly. When I choose for instance Tot.GC the 2nd column will change from Tot.LC to Tot.GC and with corresponding amounts by line.
However it shows me all lines and we are actually only interested in the Top 10 lines.
Normally you would put a TopN filter on it. But that does not seem to work with field parameters.
Does anybody know how I can get to show only a top 10 for my selected field parameters?
Solved! Go to Solution.
Ok I have been able to fix it.
Using a ranking based on the variable field parameters I was able to create a top 10:
So the second column is variable and takes the measure that is chosen in the slicer.
To make this work I had to add a copy/dummy field in my field parameter:
If you use the first column in the parameter you get errors in coming formulas.
Made the rank like :
So 1 var to determine what the choise was.
Then 3 other vars for every single option of choise.
With a switch you can then contol the rankx on which selected value from the field parameter options.
Then you have a field that ranks the selected measure from 1 to xxxx.
Only thing you then need to do is to put a filter on where you only show 10 or less :
Then I think the only option we have is for the visual to switch off word wrap on the headers and on the values.
After yoi can manually make the column Rank_Measure very small so it will not show.
ps: if somebody knows a better way to hide a column in a table visual please let me know!
Ok I have been able to fix it.
Using a ranking based on the variable field parameters I was able to create a top 10:
So the second column is variable and takes the measure that is chosen in the slicer.
To make this work I had to add a copy/dummy field in my field parameter:
If you use the first column in the parameter you get errors in coming formulas.
Made the rank like :
So 1 var to determine what the choise was.
Then 3 other vars for every single option of choise.
With a switch you can then contol the rankx on which selected value from the field parameter options.
Then you have a field that ranks the selected measure from 1 to xxxx.
Only thing you then need to do is to put a filter on where you only show 10 or less :
Then I think the only option we have is for the visual to switch off word wrap on the headers and on the values.
After yoi can manually make the column Rank_Measure very small so it will not show.
ps: if somebody knows a better way to hide a column in a table visual please let me know!
Well I tried again with the logic in that video.
But again rank shows 1 eveywhere.:
So I used the order of the parameter field tell which the measure should be that needs to be sorted.
And the rankx in 3 cases is on the same table (PF and field Prod.Fam.)
Guessing the allselected is not working because it looks at only 1 row and not all rows in the selection.
Therefore everywhere the rank is 1.
Hi @rpinxt ,
I create a table as you mentioned.
Then I create a calculated column and here is the DAX code.
Column = RANKX(ALL('Table'),'Table'[Sales],,ASC,Dense)
Finally you will get what you want.
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.
Thanks @Anonymous but what I am missing here is the part where ranking is based on a measure that will be changed by a field parameter.
That is where the difficulty is.
Lets say to make it easier you have a Sales Measure and you have a Cost measure.
You make 1 field parameter that switches between Sales and Cost.
Now you cannot make a ranking as calculated column because 1 time the user selects Sales and the other time he selects Cost.
Thanks @Sergii24 , I actually saw this video but I don't think this will help me.
The parameters here are fields in a table and then get (the same) measure for the choises.
My field parameter is based on measures which are selectable for every tabe the same table field.
I could not make the rankx working for this.
Gave me rank 1 on every line and also added blanks lines.
User | Count |
---|---|
79 | |
74 | |
42 | |
30 | |
28 |
User | Count |
---|---|
108 | |
96 | |
53 | |
48 | |
47 |