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.
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.
- Lefuneste572 years ago
Helper I
I just followed your instructions and it works fine! I learned something again 🙂 thanks to you very much. I didn't know about dynamic filters. Thanks again for your help, it’s GREAT.
Have a good day. - Lefuneste572 years ago
Helper I
I will try to follow the instructions in your link and create the measurement then integrate it into your formula. I'll keep you informed.
In any case, thank you for your valuable help. - Lefuneste572 years ago
Helper I
Can you send me the Pbx of your example please ?