Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have a query in the data, Instead showing Top N records, would need to show data only for 1-5 or 5-10 or 11-5 & etc., based on Ranking.. based on selection.. Any
Column Structure
Country Measure Time Period Value..
Country1 Value Sep'21 100000
Country2 Volume Oct'21 2000000
Solved! Go to Solution.
Here is one way using a slicer (you can also set it up using bookmarks and buttons if you prefer)
1) Create a table using "Enter Data" in the Home ribbon. This is the slicer for the TopN selection
2) This is how my sample model is set up, which is relevant for the measures and visuals:
Then create the following measures:
Sum Sales =
SUM(FactTable[Sales])
Rank by sales =
RANKX(ALL('Country Table'[Country Table]), [Sum Sales],,DESC)
and finally the measure for the matrix
TopN Measure =
VAR _Table =
SUMMARIZE ( FactTable, 'Country Table'[Country Table], 'Period Table'[Period] )
RETURN
SWITCH (
SELECTEDVALUE ( 'TopN'[Index] ),
1, CALCULATE ( [Sum Sales], FILTER ( _Table, [Rank by sales] < 4 ) ),
2,
CALCULATE (
[Sum Sales],
FILTER ( _Table, [Rank by sales] > 3 && [Rank by sales] < 7 )
),
3,
CALCULATE (
[Sum Sales],
FILTER ( _Table, [Rank by sales] > 6 && [Rank by sales] < 10 )
),
4, CALCULATE ( [Sum Sales], FILTER ( _Table, [Rank by sales] > 9 ) ),
[Sum Sales]
)
and this is what you get
I've attached the sample PBIX file
Proud to be a Super User!
Paul on Linkedin.
Hi @msaninfo,
Did PaulDBrown 's suggestions help with your scenario? if that is the case, you can consider Kudo or accept his suggestions to help others who faced similar requirements.
If that also doesn't help, please share more detailed information to help us clarify your scenario to test.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
Here is one way using a slicer (you can also set it up using bookmarks and buttons if you prefer)
1) Create a table using "Enter Data" in the Home ribbon. This is the slicer for the TopN selection
2) This is how my sample model is set up, which is relevant for the measures and visuals:
Then create the following measures:
Sum Sales =
SUM(FactTable[Sales])
Rank by sales =
RANKX(ALL('Country Table'[Country Table]), [Sum Sales],,DESC)
and finally the measure for the matrix
TopN Measure =
VAR _Table =
SUMMARIZE ( FactTable, 'Country Table'[Country Table], 'Period Table'[Period] )
RETURN
SWITCH (
SELECTEDVALUE ( 'TopN'[Index] ),
1, CALCULATE ( [Sum Sales], FILTER ( _Table, [Rank by sales] < 4 ) ),
2,
CALCULATE (
[Sum Sales],
FILTER ( _Table, [Rank by sales] > 3 && [Rank by sales] < 7 )
),
3,
CALCULATE (
[Sum Sales],
FILTER ( _Table, [Rank by sales] > 6 && [Rank by sales] < 10 )
),
4, CALCULATE ( [Sum Sales], FILTER ( _Table, [Rank by sales] > 9 ) ),
[Sum Sales]
)
and this is what you get
I've attached the sample PBIX file
Proud to be a Super User!
Paul on Linkedin.
I would need to display the list of countires and sum of sales nos. grouping by 5.... 1-5 or 6-10 & ..., based on latest time period.. The slicer option would be 1-5, 6-10, 11-15, 16-20...
below the sample matrix table . The list of 5 countries should change baed on selection...
Is the TopN monthly? yearly?...
Proud to be a Super User!
Paul on Linkedin.
Can you please provide a larger data sample? It's hard to work on a TopN with only two rows (and you have a column for different measures, which ideally should be pivoted to create different columns for each measure)....What measure is the TopN supposed t calculate?
Proud to be a Super User!
Paul on Linkedin.
Below is the data fields....
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
96 | |
95 | |
82 | |
71 | |
64 |
User | Count |
---|---|
115 | |
105 | |
95 | |
79 | |
72 |