cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mjmjn2611
Frequent Visitor

Dynamic measure based on the selected value of the slicer

Hi, 

 

I want to create a dynamic measure where when I choose the value from the slicer, the row that contains the data from slicer with have an updated formula, other will have another formula. 

 

For example:  

If I choose product A, then the sales for product A would be calculated as 100 + sum(Sales) 

Other products 200 + sum(Sales)

1 ACCEPTED SOLUTION
Eyelyn9
Community Support
Community Support

Hi @mjmjn2611 ,

 

To my knowledge, you need to create a new table for slicer:

 

ForSlicer = VALUES('Table'[Product])

 

Then please try this:

 

Result = IF( MAX('Table'[Product]) in ALLSELECTED(ForSlicer[Product]),100+SUM('Table'[Sales]), 200+SUM('Table'[Sales]))

 

The final output is shown below:

dynamic sales.gif

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Eyelyn9
Community Support
Community Support

Hi @mjmjn2611 ,

 

To my knowledge, you need to create a new table for slicer:

 

ForSlicer = VALUES('Table'[Product])

 

Then please try this:

 

Result = IF( MAX('Table'[Product]) in ALLSELECTED(ForSlicer[Product]),100+SUM('Table'[Sales]), 200+SUM('Table'[Sales]))

 

The final output is shown below:

dynamic sales.gif

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

amitchandak
Super User IV
Super User IV

@mjmjn2611 , Try a measure

if(countx(filter(Table, Table[Product] = "Product A"),[Product]) >0 , 100 + sum(Sales) , 200 + sum(Sales) )



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

@amitchandak 

Thank you for your solution. 

 

The name of the product is not constant, I get it from the slicer. I am using Selectedvalue(slicer) to get the value for the product name. It doesn't work. 

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

Get Ready for Power BI Dev Camp

Power BI Dev Camp - September 30th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors