Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
Hi,
I want to calculate TotalQty from previous year. The current year should be selected by the left slicer.
That means the PrevYear is always the selected year in the slicer minus 1.
Here is what I did:
I used SELECTEDVALUE(dimdatum(Jahr)) to get the selected year. The same formula I used in the measure called SelectedYear, and as you can see, the SELECTEDVALUE(dimdatum(Jahr)) is 2022 if 2022 is selected in the slicer.
But the column SoldQtyPrevYear is empty for some reason.
If I preset the VAR SelectedYear in my measure with 2022 then it works as expected:
How do I get this working with SELECTEDVALUE(DimDatum[Jahr])?
Hi @TM_AC ,
Can you share the data type and data format of dimdatum [Jahr]?
Please try using this variable.
VAR SelectedYear = SELECTEDVALUE('dimdatum'[Jahr].[Year])
Best Regards,
Community Support Team Gao
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems with it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
@Anonymous , thnks for reply, but could not get there:
I could not enter .[Year] behind.
The datatype and format is 'whole number'.
@TM_AC can you return as a final result the VAR SelectedYear (put in the RETURN this var) and put the result in the matrix and screenshot what you get
@SpartaBI thanks for your help,
I added a new measure called 'Test' and put it right to 'SoldQtyPrevYear'.
It shows 2022 if I select 2022 on the slicers, for other years I chose on the slicer it works as well.
It seams that only the measure for 'SoldQtyPrevYear' could not hanlde the SELECTEDVALUE(...).
Strange, Can you share the file maybe?
How can I share (here)?
Put it in some sharable drive like dropbox or something similar, or on your own gdrive maybe and make the path to only this file public and share the link
@SpartaBI I asked but unfortunately I am not allowed to share this file due to security issues.
But I think there must be a way to get it solved here.
I did not anything special here just used SELECTEDVALUE(DimDate[Year]) inside my measure.
And for some reason it does not work.
@TM_AC I admit that it's a mystery to me too. In case the selectedvalue returns 2022 in that filter context and you also put it inside a VAR I can't understand how it returns different results than hard coding 2022 cause everything else ia the same. Try post this question again, maybe someone will understand what we are missing here
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 79 | |
| 38 | |
| 31 | |
| 27 | |
| 27 |