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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
King8James
Regular Visitor

Dyanmic Sales measure related to selected value from slicer

Hello,

I need a measure that gives the sales of selected scenario and adds preivous sales  i have created the folowing measure

 

New sales =
var forcast = SELECTEDVALUE(scenario[Alternative])
return
CALCULATE( sum(data[Sales]), FILTER(data, data[Alternative]= "FIX" && data[Alternative]= "Forecast")

King8James_0-1660137950616.png

the issue i have is the overlap in month may june and july (it can change depending on the chosen scenario) how can i filter the duplicate value from fix so that i have all values from var 1 or var 2 (selected scenario) and the values that dosent exist from FIX like that 

 

King8James_1-1660138232335.png

here the data source

 

King8James_2-1660138291191.png

 







2 REPLIES 2
Anonymous
Not applicable

Hi @King8James,

You can use switch and selectedvalue function to redirect to different calculation expressions based on current selected value.

My Favorite DAX Feature: SELECTEDVALUE with SWITCH | Winston-Salem Power BI User Group (pbiusergroup...

Regards,

Xiaoxin Sheng

hey thanks for you reply,

 

the issue i have is : i have to include the whole sales of the selected scenario for example if i choose var 1 sales start from may till january 2023 and fix should be the months before may (if  i choose var2  sales start from june 2022 till january 2023 and fix should be the months before june ) so the values of fix are  variable and depend on the chosen scenario.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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