Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

Slicer for dynamic Indes

Hello,

 

I created a measure for a dynamic Index for a ranking:

 

dynamic slicer.JPG

I would like to have slicer for this, to select the top N with it. 

 

Can someone help me? I cant put this measure in a slicer 😕

 

Thank you in advance

1 ACCEPTED SOLUTION

Here are more details

 

1. Make a What If Parameter (you've already done that for your Rank slicer

2.  Make a measure like this one (using your tables, columns, measures

 

RankSales = var rankvalue = RANKX(all(Sales[Product]), CALCULATE(sum(Sales[Sales])))
var rankthreshold = SELECTEDVALUE(RankSelect[RankSelect]) //this is your slicer table and column
return if(rankvalue<=rankthreshold, rankvalue, BLANK())
 
3.  Use this measure in the visuals you want to filter.  Highlight each visual you want to filter with the slicer.  For each, in the Filters pane on the right, drag your new measure into the "Filters On This Visual" area and choose "is not blank".
 

If this works for you, please mark it as solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat

 




Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

5 REPLIES 5
mahoneypat
Employee
Employee

Since you can't use a measure in a slicer, would you get the same effect by having a What If parameter/slicer and using a dynamic TopN approach instead (using the value selected on the slicer as the N in your TopN()?  That way, only the countries with a rank below the selected value would show up in your visual.

 

This article show one good way to do it - https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/3...

 

If this works for you, please mark it as solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Would it work to use a measure filter on your visual(s) and/or page?  See this article for more details - https://www.sqlbi.com/articles/applying-a-measure-filter-in-power-bi/

 

In the measure you use as the filter, it could dynamically reference a slicer or whatif parameter on your page.

 

If this works for you, please mark it as solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

@mahoneypat  I dont understand that 😕

 

I want to have slicer like this one: 

 

slicer.JPG

 

Maybe I could create a column with an dynamic Index and not a mesaure, but I dont know how. If try to use the some code for custom column it doesnt work. It shows, that "minx" is not recognised.

 

 

Here are more details

 

1. Make a What If Parameter (you've already done that for your Rank slicer

2.  Make a measure like this one (using your tables, columns, measures

 

RankSales = var rankvalue = RANKX(all(Sales[Product]), CALCULATE(sum(Sales[Sales])))
var rankthreshold = SELECTEDVALUE(RankSelect[RankSelect]) //this is your slicer table and column
return if(rankvalue<=rankthreshold, rankvalue, BLANK())
 
3.  Use this measure in the visuals you want to filter.  Highlight each visual you want to filter with the slicer.  For each, in the Filters pane on the right, drag your new measure into the "Filters On This Visual" area and choose "is not blank".
 

If this works for you, please mark it as solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat

 




Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

Hi @mahoneypat,

 

I tried this already. The problem with this aproach is, that the table doesnt interact with my other visuals from other tables. When I create a parameter, its the same like a new table and I dont have any relationship to the other one. I already tried this. =/

 

For me personaly it would be the best way to create a slicer with my created measure.

 

Is that possible?

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.