Forum Discussion
Show Diff PY just once
Dear all,
I would like to show a qty vs. previous year qty comparison. Therefore I already created a measure which calculates the % diff to last year. Do you have any idea how I could remove the yellow marked column? I would like to see the information on % diff only for year 2025.
Thank you very much in advance for your help.
v-sdhruv Many thanks for your feedback!
Now I put a white square over the text to hide the headline "Diff % LY" for 2024. Probably not the best solution but I couldn´t find another one 😉 .
Thanks again for all the help.
17 Replies
- grasaHelper I
FBergamaschi , jaineshp Thank you very much for your fast reply on this. Unfortunately none of the new measures solved my problem.
Here is my measure for the Diff % LY calculation, maybe this helps:
Gesamtmenge = Total Qty
Menge = Qty
Thanks again and best regards,
Sarah
- jaineshpMemorable Member
Hey grasa,
Key Points:
- The issue occurs because Januar 2025 has no corresponding Januar 2024 data in your dataset
- Your original measure works fine when both current and previous year data exist
- These solutions handle the missing previous year data scenario
- Choose Option 1 if you want blanks, Option 2 for zeros, or Option 3 for custom text
Try this:
Diff % LY Modified =
IF(
ISBLANK([LY Menge]),
BLANK(),
DIVIDE([Gesamtmenge] - [LY Menge], [LY Menge])
)Fixed? ✓ Mark it • Share it • Help others!
Best Regards,
Jainesh Poojara | Power BI Developer
- FBergamaschiSuper User
create this measure and use it in place of the current one
CALCULATE (
[Diff % LY],
KEEPFILTERS(Date[year] = 2025)
)Date[year] might have to be changed based on the name of your tables/columns
If this helped, please consider giving kudos and mark as a solution
me in replies or I'll lose your thread
Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page
Consider voting this Power BI idea
Francesco Bergamaschi
MBA, M.Eng, M.Econ, Professor of BI
- v-sdhruvCommunity Support
Hi grasa ,
This might be because" January 2025 has no corresponding January 2024 data in your dataset." as earlier stated by jaineshp
As per the measure, it will show blank() but you can modify the measure by using:Diff % LY Modified = IF ( YEAR ( MAX ( 'DateTable'[Date] ) ) <> 2025, BLANK(), IF ( ISBLANK ( [Gesamtmenge] ) || ISBLANK ( [LY Menge] ), BLANK(), DIVIDE ( [Gesamtmenge] - [LY Menge], [LY Menge] ) ) )This ensures the measure only returns values for 2025
Hope this helps! - v-sdhruvCommunity Support
Hi grasa ,
Thanks for sharing the details and screenshots. I’ve reviewed the measure and the visuals, but I’m not entirely sure why the 2024 column is still appearing despite the logic intended to filter it out.
Are there any filters or slicers applied that might be influencing the display?Understanding this will help pinpoint whether the issue is with the measure logic or the visual configuration.
Thank You - v-sdhruvCommunity Support
Hi grasa ,
Thanks for the update. I see what you are trying to achieve here.
Since it is a matrix visual you cant directly hide Diff % LY Modified which appears as a column.
In order to hide for 2024, You can try to go visual level filter-> Disable for Year 2024.
This will not show data for 2024.
Hope this helps! - sivarajan21Post Prodigy
Hi grasa ,
Method 1: Conditional Formatting with Blank Values
Modify your "Diff % LY" measure to return BLANK() for 2024:
Diff % LY = IF( YEAR(MAX('YourTable'[Date])) = 2024, BLANK(), [Your existing Diff % LY calculation] )If the above doesn't work, then please follow below:
Method 2: Using SELECTEDVALUE with Year Filter
If you're using a year slicer or filter, you can modify the measure:
Diff % LY = IF( SELECTEDVALUE('YourTable'[Jahr]) = 2024, BLANK(), [Your existing Diff % LY calculation] )Please try the above and let me know if you still face the issue
Best Regards,
- grasaHelper I
Hi sivarajan21 ,
Thank you very much for your reply.
Unfortunately both versions didn´t work, I still see the empty column for 2024.
Method 1:
Method 2:
I think the problem really is the matrix visual, as mentioned by v-sdhruv in the previous post.
But thanks again for all the help.