Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi all,
I am trying to create a variable in DAX, with the selected value based on the slicer selection (single).
I have read articles, that I am able to call the selected value from a slicer using SELECTEDVALUE().
Here's my situation:
Is there anything wrong that I am doing here? Please let me know if I should post more info or if this is not possible in DAX.
Thank you!
Hi @OwenAuger,
The selectedvalue is calling a table with fixed values of 1 to 12.
However the table (CM/YTD Selection) which I am trying to "filter" does contain a calculation dependent on which period it is (current manually entered as a variable), to populate the table.
I have also tried referencing the variable to a measure with the selectedvalue, however the same blank error is churned out.
**EDIT: PMed you the dropbox link for the sample PBIX.
Thanks for your prompt assistance!
Hi @jason91
By any chance are you using SELECTEDVALUE(...) to get the selected period within a calculated column? Calculated columns cannot respond to filters from slicers or other filters in the report itself as they are processed in an unfiltered filter context independent of the report. In a calculated column, the SELECTEDVALUE expression would therefore return BLANK() and be treated as zero in calculations.
Any logic relating to the selected value of 'Report Period Selection'[Report Period] would have to be handled within measures.
If you are already using it within a measure, then the only thing I could think of is that the interactions between visuals may not be set up correctly, and the slicer may not be filtering some visuals. You can check that on Format > Edit Interactions.
Could you post a sample PBIX demonstrating the issue?
Regards,
Owen
Adding dropbox link for anyone else who is interested in this problem as well:
https://www.dropbox.com/s/dzjlwb090zujnbs/Sample%20Selection.pbix?dl=0
Hi again @jason91
Thanks for your PBIX file 🙂
I've had a look - the issue is that a calculated table (i.e. one created with DAX) cannot respond to the selection on a slicer, same as a calculated column. Calculated tables & columns are processed in an unfiltered filter context as part of creating the dataset ("before" the report is generated), so are independent of any filters applied in the report. SELECTEDVALUE(...) will return blank in this case.
The logic within the CM/YTD Selection table that depends on Report Period would need to be captured in one or more measures.
From what I can see of you CM/YTD Selection table, you most likely will want to create:
That's a general idea anyway. If you had an example of how you want the final report to look based on different selections, I could try to give a more specific answer.
All the best,
Owen
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
20 | |
7 | |
6 | |
5 | |
5 |
User | Count |
---|---|
26 | |
10 | |
10 | |
9 | |
6 |