Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi,
I am trying to replicate the function of a TopN visual level filter, so I can use it with a What If parameter to make it dynamic for the users of a report.
I'd like to show the TopN of an item all time, but then break this down by the value that item acheived each week. I have tried several options, but I cannot seem to get it to ignore the date filter to find "all time" then re-apply the date filter to show the top N across time.
Below is an example, where 'MARKET SALES' is my fact table, 'TABLE 1'[TABLE Code] is the item I want to do the TopN for and I'm trying to filter the Calculate table by the whole calendar.
SUMX (
TOPN (
[Top Number Selector Value],
CALCULATETABLE (
SUMMARIZE ( 'MARKET SALES', 'TABLE 1'[TABLE Code] ),
ALL ( 'RLS CALENDAR' )
),
[Total value], DESC
),
[Total value]
)
Unfortunately this presents more items from 'TABLE 1'[TABLE Code] than the number selected in the TOP Number slicer.
Solved! Go to Solution.
I have resoloved this by using a RANKX, inside a calculate that removes the calendar context from RANKX, here's my solution:
VAR Number_to_Rank = [Top Number Selector Value]
VAR Val = [Total value]
RETURN
IF (
CALCULATE (
RANKX ( ALLSELECTED ( 'TABLE 1'[TABLE Code] ), [Total value] ) <= Number_to_Rank,
ALL ( 'RLS CALENDAR' )
),
Val
)
I have resoloved this by using a RANKX, inside a calculate that removes the calendar context from RANKX, here's my solution:
VAR Number_to_Rank = [Top Number Selector Value]
VAR Val = [Total value]
RETURN
IF (
CALCULATE (
RANKX ( ALLSELECTED ( 'TABLE 1'[TABLE Code] ), [Total value] ) <= Number_to_Rank,
ALL ( 'RLS CALENDAR' )
),
Val
)
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
11 | |
10 | |
10 | |
9 |
User | Count |
---|---|
18 | |
13 | |
12 | |
11 | |
8 |