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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
MWare
Helper I
Helper I

Help with SELECTEDVALUE measure please

Hi all,

 

I'm looking for some help with a SELECTEDVALUE measure.

I've created 2 seperate measures and applied them as filters to 2 seperate tables and can return the result I'm looking for however I need it to work in just 1 table so essentially combining the 2 measures and applying it to the 1 table to have the the same effect.

 

I've added further details in the attached file.

 

https://drive.google.com/file/d/1-L3RBtlcXlqZbqkrRYzVypc8mWIxlJdU/view?usp=sharing

 

Thanks

Marc

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @MWare 

 

You can try the following methods.

Maesure:

Measure 2 = 
Var p=CALCULATE(max(Date_Period_Table[Period]),ALL(Date_Period_Table),Date_Period_Table[Date]=SELECTEDVALUE('Date'[Date])) 
return 
IF(SELECTEDVALUE(Date_Period_Table[Period])=p && SELECTEDVALUE(Date_Period_Table[Date])=SELECTEDVALUE('Date'[Date]),"Day Selected",
IF(SELECTEDVALUE(Date_Period_Table[Period])=p && SELECTEDVALUE(Date_Period_Table[Date])<=SELECTEDVALUE('Date'[Date]),"PTD"
))

vzhangti_0-1653899844199.png

Measure 3 = 
IF([Measure 2]=SELECTEDVALUE('Reporting View'[Reporting View]),1,0)

At this point the result can be run in a view.

vzhangti_1-1653899909189.pngvzhangti_2-1653899931729.png

 

Best Regards,

Community Support Team _Charlotte

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

6 REPLIES 6
MWare
Helper I
Helper I

@v-zhangti Many thanks for the solution however the PTD values need to go up to and include the selected date.  The solution you have created doesn't include the date selected when PTD is selected.

Hi, @MWare 

 

You can try the following methods.

Measure:

Measure Day Selected = 
Var p=CALCULATE(max(Date_Period_Table[Period]),ALL(Date_Period_Table),Date_Period_Table[Date]=SELECTEDVALUE('Date'[Date])) 
return 
IF(SELECTEDVALUE(Date_Period_Table[Period])=p && SELECTEDVALUE(Date_Period_Table[Date])=SELECTEDVALUE('Date'[Date]),"Day Selected")
Measure PTD = 
Var p=CALCULATE(max(Date_Period_Table[Period]),ALL(Date_Period_Table),Date_Period_Table[Date]=SELECTEDVALUE('Date'[Date])) 
return 
IF(SELECTEDVALUE(Date_Period_Table[Period])=p && SELECTEDVALUE(Date_Period_Table[Date])<=SELECTEDVALUE('Date'[Date]),"PTD"
)

vzhangti_0-1653976782469.png

Measure 3 = 
IF([Measure Day Selected]=SELECTEDVALUE('Reporting View'[Reporting View]),1,
   IF([Measure PTD]=SELECTEDVALUE('Reporting View'[Reporting View]),1,0))

vzhangti_1-1653976856182.png

 

Best Regards,

Community Support Team _Charlotte

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

 

@v-zhangti Hi, did you need to do anything to the formating of the measures or anything else as I've tried to recreate this a number of times in new reports and each time the Day Selected will work and just show day selected in Date filter however when I select PTD it will only return the value that's selected in the Date filter.  Obviously in the file that you worked on, the measures and concept all works perfectly, but as I say when I try to replicate this in a new report from scratch I get the issue with the PTD only returning the date in the Date filter and not all the dates prior to the Date filter that are included within the Period.

v-zhangti
Community Support
Community Support

Hi, @MWare 

 

You can try the following methods.

Maesure:

Measure 2 = 
Var p=CALCULATE(max(Date_Period_Table[Period]),ALL(Date_Period_Table),Date_Period_Table[Date]=SELECTEDVALUE('Date'[Date])) 
return 
IF(SELECTEDVALUE(Date_Period_Table[Period])=p && SELECTEDVALUE(Date_Period_Table[Date])=SELECTEDVALUE('Date'[Date]),"Day Selected",
IF(SELECTEDVALUE(Date_Period_Table[Period])=p && SELECTEDVALUE(Date_Period_Table[Date])<=SELECTEDVALUE('Date'[Date]),"PTD"
))

vzhangti_0-1653899844199.png

Measure 3 = 
IF([Measure 2]=SELECTEDVALUE('Reporting View'[Reporting View]),1,0)

At this point the result can be run in a view.

vzhangti_1-1653899909189.pngvzhangti_2-1653899931729.png

 

Best Regards,

Community Support Team _Charlotte

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

 

@v-zhangti  That's brilliant! thanks so much for your help!

@v-zhangti  I've tried to replicate the solution in my actual model but it doesn't work as the relationship between the date and sales table in my actual model is One to Many (cross filter both directions) and not One to One as it is in the sample model provided.  Do you know if there is a way round this please?

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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