Forum Discussion
How to create a segment with N first line from a table report order bye amount value ?
- 2 years ago
Lefuneste57 - Just to clarify, my solution will work for you & it is dynamic (because it uses a measure), so the ranking will be re-calculated according to any filters you use on the page.
But you will need to use the measure below in any visual that you want to see this behaviour. There is no need to use a page filter because the measure handles the visual filtering. So if you want to filter an entire page, place the measure in every visual.
It works by only displaying the amount value when the rank number is lower than or equal to the number in the slicer. The slicer is created using these instructions: https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-what-if
VAR Number_to_Rank = [Number of Lines (by order amount) Value] // from the numeric range parameter VAR _amount = [_amount] // sum( amount ) RETURN IF ( RANKX ( ALLSELECTED ( 'Table (6)'[Item], 'Table (6)'[Build] ), [_amount] ) <= Number_to_Rank, _amount ) // Returns the amount for any items that with a rank within the numbers specified in the Numeric range parameter.
Hi,
Thanks for your answer but
Lefuneste57 - Sorry, I thought you may already be able to create a Numeric Range Parameter for the first part of my solution.
Here are the instructions, https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-what-if, once you have followed these, you will get a measure in the new parameter table that you can reference in your Dynamic Rank measure.
In my solutuion, the measure that is auto generated by the parameter is
[Number of Lines (by order amount) Value]
because I have named the parameter "Number of Lines (by order amount)"