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
ahuhn
Helper I
Helper I

Use parameter in measure

I have a simple dataset

 

StatusMonthUpdated
Alpha201810
Alpha201810
Beta201810
Gamma201810
Delta201809
Alpha201809
Alpha201809
Alpha201808

 

What I want to do is create two parameters so the user can find the difference in counts between two months. I want the user to select month1 = their choice (preferaby from a table or dropdown), select month2 = their choice as well. ie difference between 201810 and 201809 for Alpha status is 0, but 201810 and 201808 is 1

 

So far, I tried:

 

1) Measure = CALCULATE(COUNT(Sheet1[Status]),FILTER(Sheet1,[MonthUpdated]=YYYYMM && [Status]="Alpha")), but this does not update when I change the parameter value YYYYMM via home --> edit queries --> edit parameters

 

2)  Following from https://community.powerbi.com/t5/Desktop/use-parameters-in-dax/m-p/536964/highlight/false#M251956 does not work, as this uses slicers, and after selecting for one month via a slicer table, the second selection is limited to the value of the first slicer,

 

3) Following https://community.powerbi.com/t5/Desktop/Use-parameter-in-measure/m-p/349842#M157174 failed because the what-if parameter permits only continuous numeric values.

 

Suggestions are most appreciated

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

I would use two disconnected tables with your values and two slicers. Use MAX to grab the value of your slicer. You could create your tables by using something like:

 

Table1 = DISTINCT('Table'[MonthUpdated])

Table2 = DISTINCT('Table'[MonthUpdated])

 

Don't relate them to anything.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

1 REPLY 1
Greg_Deckler
Super User
Super User

I would use two disconnected tables with your values and two slicers. Use MAX to grab the value of your slicer. You could create your tables by using something like:

 

Table1 = DISTINCT('Table'[MonthUpdated])

Table2 = DISTINCT('Table'[MonthUpdated])

 

Don't relate them to anything.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.