Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
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
Solved! Go to Solution.
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"
))
Measure 3 =
IF([Measure 2]=SELECTEDVALUE('Reporting View'[Reporting View]),1,0)
At this point the result can be run in a view.
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 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"
)
Measure 3 =
IF([Measure Day Selected]=SELECTEDVALUE('Reporting View'[Reporting View]),1,
IF([Measure PTD]=SELECTEDVALUE('Reporting View'[Reporting View]),1,0))
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.
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"
))
Measure 3 =
IF([Measure 2]=SELECTEDVALUE('Reporting View'[Reporting View]),1,0)
At this point the result can be run in a view.
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 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?
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
81 | |
76 | |
61 | |
37 | |
33 |
User | Count |
---|---|
99 | |
56 | |
51 | |
42 | |
40 |