March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi,
Thanks for looking into the query.
I have a table with date wise values of Sales of the client names. (Client name, Date, Sales)
I have created a dax measure as below that gives me YTD numbers as per year selected in Year slicer. Years coming from Master calendar table and that table is connected with Sales table, Date column.
Solved! Go to Solution.
Hi @harshadrokade ,
Try the following code:
New Ranking =
SWITCH (
SELECTEDVALUE ( Slicer_Table[Slicer] ),
"Top10",
IF (
RANKX (
ALLSELECTED( SalesTable[Client]),
CALCULATE([1.YTD Net amt],ALLEXCEPT(SalesTable, SalesTable[Client]))
,
,
) <= 5,
1
),
1
)
File attach.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @harshadrokade ,
Here are the steps you can follow:
1. Enter data – create a table.
2. Create measure.
Rank =
RANKX(
ALLSELECTED('SalesTable'),[1.YTD Net amt],,DESC,Dense)
Flag =
var _select=SELECTEDVALUE('Slicer_Table'[Slicer])
return
SWITCH(
TRUE(),
_select="Top10" && [Rank]<=10,1,
_select="All" && [Rank]>=1,1,0)
3. Place [Flag]in Filters, set is=1, apply filter.
4. Result:
Select Top10:
Select All:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Thanks @v-yangliu-msft . The slicer is not filtering the table as expected. can you pls check
Hi @harshadrokade ,
In this case you need to create a table for the disconnected slicer then you need to create a measure that picks up that value something similar to this:
Ranking =
SWITCH (
SELECTEDVALUE ( 'TOPN'[TOPNSelection] ),
"Top 10",
IF (
RANKX (
ALLSELECTED ( Customer[Customer] ),
[Sales],
[Sales],
DESC
) <= 10,
1
),
1
)
Then use this metric on the visual and select on when is not blank.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThanks @MFelix . Ther is no disconnected table. The Sales table and master calendar are connected and so I am not sure how to follow your instructions.
The disconnected table is a new one that you need to create for doing the slicer nothing more. That table only contais two values All and Top 10.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThanks @MFelix
What do you mean by Then use this metric on the visual and select on when is not blank.
Where exactly I use this newly created measure on visual? and what do you mean by when its not blank?
Pls help
Just add it to your visual filter in the filter pane, then the option you select is the advanced is not blank. When you apply that filter the visualization gets filter out.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsOK. Will try. Thanks
If you are not abble to achieve necessary result please let me know and I will send you a PBIX file for test.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThanks @MFelix. I could get the results partially but facing an issue in the drill downs.
I forgot to mention that I have one more column as Sub client name. So I have columns as below in Sales table-
A measure is also creaed to get YTD sales as 1.YTD Net amt
Sharing steps that I followed-
1) Created a disconnected Slicer table with values as Top10 and All
2) Created a measure as below to get the rank on Client name level based on YTD numbers
Hi @harshadrokade ,
Try the following code:
New Ranking =
SWITCH (
SELECTEDVALUE ( Slicer_Table[Slicer] ),
"Top10",
IF (
RANKX (
ALLSELECTED( SalesTable[Client]),
CALCULATE([1.YTD Net amt],ALLEXCEPT(SalesTable, SalesTable[Client]))
,
,
) <= 5,
1
),
1
)
File attach.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsAll works fine when I remove my existing relationship between Sales table and master calendar table but when I keep it, the top 10 filter doesnt work. I cant remove it as it filters few other charts on dashboard.
I have used the file you have sent that did not had any relationship so I did not even made any change to that part of the formula, try to chenge your YTD to the following:
1.YTD Net amt =
TOTALYTD(SUM([Net_Amount]), 'Master Calendar'[Date])
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsU r awesome. Thanks for ur valuable time and support 🙂
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
129 | |
90 | |
75 | |
58 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |