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
Wkeith
Helper II
Helper II

Measure as a Filter on a page/visual

So I have a measure:

Active Acount If = if([Before 4 month rolling Revenue]<=0 && [Rolling 4 quarter Revenue]>0,"New Account", if([Before 4 month rolling Revenue]>0 && [Rolling 4 quarter Revenue]>0,"Active Current Account", if([Before 4 month rolling Revenue]>0 && [Rolling 4 quarter Revenue]<=0,"Non-Active Current Account", "Never Active")))

This measure basically classifies different accounts based on wheter or not they are active (that isn't the important part). What I am trying to do is use this measure as a filter on my page so that a user can look at only certain users defined in my dax above. 

 

Initially, I used this article to solve my problem https://community.powerbi.com/t5/Desktop/Measure-as-Slicer-Workaround/td-p/611781. However, what I have noticed is that this workaround only works if my data is the "table" format and not other formats (such as a bar chart). So when I use my slicer and select a group it effects my table but it doesn't effect my bar chart (maybe because I don't have the individual accounts listed in the bar chart like I do in the table?).

 

Does anyone know how to create a measure as a filter so that it effects all my charts and not just my table? 

 

 

This is my other dax formula that is used as a visual level filter on both my table and my bar chart that refrences a drop down slicer of my diffrent account names: 

New Account Filter Table = if([Active Acount If]= SELECTEDVALUE('For New Account Filter'[Column1]),1,if(SELECTEDVALUE('For New Account Filter'[Column1])="All",2,0))

 

I know this is confusing so i'll be around to answer questions. Also I can't post my data as it is sensitive info. Thanks!

7 REPLIES 7
Cmcmahan
Resident Rockstar
Resident Rockstar

As far as I'm aware, measures can only be used as filters at a visual level. But you can apply the same visual level filter to every visual on your page. 

 

What exactly are you trying to do with this bar chart?  Depending on what this measure actually looks like, you might want to consider setting it up as a calculated column and just being done with it.

My measure looks back 12 months for each user and classifies them based on if they have sales or not. So I wanted this calculation to be dynamic (aka a measure) so that a user can change the date on the page (through a date slicer) and see which users were active in different periods in time. Then the user would be able to filter the page based on these classifications (through a slicer of the measure). It seems like this can't be done/is too complicated. Is that correct? 

 

For some reason, the work around article that I posted in my original post in this thread works but only when the visual is in table format (aka my bar chart dosent work). Also I have callouts on the page and those don't accept visual level filters like this. So it seems that I can only keep my classification as a measure if I just want to look at the data in a table format. 

If this is just a IsActive = True/False type of measure,  you should be able to just set it as a Visual level filter for each visual. 

 

You might also be able to set up a page level filter on Sales not being BLANK()/0, but I'd need to more about how your data tables are set up to give a definite answer on that

These are my measures:

Calculates the revenue for the last 12 months on a rolling basis

Rolling 4 quarter Revenue = CALCULATE([TOTALREVENUE],DATESBETWEEN(DimDate[DateKey],EDATE(MIN(DimDate[DateKey]),-9),MAX(DimDat
e[DateKey])))
Before 4 month rolling Revenue = CALCULATE([TOTALREVENUE],DATESBETWEEN(DimDate[DateKey],EDATE(MIN(DimDate[DateKey]),-36),EDATE(MAX(DimDate[DateKey]),-12)))
Calculates the revenue before the last 12 months on a rolling basis
Active Account If = if([Before 4 month rolling Revenue]<=0 && [Rolling 4 quarter Revenue]>0,"New Account", if([Before 4 month rolling Revenue]>0 && [Rolling 4 quarter Revenue]>0,"Current Active Account", "Neither"))
Is my IsActive measure that uses the previous two measures. 
 
My IsActive measure can't be used in a card visual and when it is in the bar chart format it has to have the accounts name in the X-asix in order to work otherwise it just gives me the total revenue for all accounts in that time period. 
 
 
The current workaround code I am using as a visual level filter that I set to "is not 0" (as refrenced in the original workaround that I posted above) that refrences a small disconnected table that has my three different classifications in it:
New Account Filter Table 2 = if([Active Account If]= SELECTEDVALUE('For New Account Filter'[Column1]),1,if(SELECTEDVALUE('For New Account Filter'[Column1])="All",2,0))
Ashish_Mathur
Super User
Super User

Hi,

Can you share a dummy dataset and show the expected result?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Wkeith
Helper II
Helper II

@Cmcmahan I know you got me on this 🙂

 

Basically how do I get a measure to filter my page, not just a table. 

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.