Forum Discussion

grasa's avatar
grasa
Helper I
1 year ago
Solved

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.

 

  • grasa's avatar
    grasa
    11 months ago

    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

  • 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

     

     

    • jaineshp's avatar
      jaineshp
      Memorable 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

      • grasa's avatar
        grasa
        Helper I

        jaineshp 

        Many thanks again! Indeed I have missing data, but for 2025.

         

        If I use your measure but use "Gesamtmenge" instead of "LY Menge", the -100% for the missing data dissapears (that is also really nice to have, thanks 😊), but the empty Diff % LY column for 2024 still stays there.

         

         

         

  • jaineshp's avatar
    jaineshp
    Memorable Member

    Hey grasa,

    Create a new version of your Diff % LY measure with conditional logic

     

    Diff % LY Modified =
    IF(
    YEAR(MAX('DateTable'[Date])) = 2024,
    BLANK(),
    [Your existing Diff % LY measure]
    )

     

    Fixed? ✓ Mark it • Share it • Help others!


    Best Regards,
    Jainesh Poojara | Power BI Developer

  • 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-sdhruv's avatar
    v-sdhruv
    Community 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!

    • grasa's avatar
      grasa
      Helper I

      Hi v-sdhruv ,

      Thank you very much for your reply and your suggestion. Unfortunately it does the same as the other ones. It shows blanks for the missing values but still shows up in the 2024 column. 

       

       

       

  • v-sdhruv's avatar
    v-sdhruv
    Community Support

    Hi grasa ,

    Just wanted to check if you got a chance to review the suggestions provided and whether that helped you resolve your query?


    Thank You

  • v-sdhruv's avatar
    v-sdhruv
    Community 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

    • grasa's avatar
      grasa
      Helper I

      Hi v-sdhruv ,

      Many thanks for your fast reply on this.

      I don´t have any filters applied. 

       

       

      Do you think it is because there are also vlaues for 2026 and 2027? Not for this quantity in my visual but for other fields in my data.

       

      Thanks again 

  • v-sdhruv's avatar
    v-sdhruv
    Community 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!

    • grasa's avatar
      grasa
      Helper I

      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.

       

       

  • 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,

    • grasa's avatar
      grasa
      Helper 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.

       

  • v-sdhruv's avatar
    v-sdhruv
    Community Support

    Hi grasa ,

    Thanks for sharing the update! Glad it worked out for you.
    If you have got a chance to try the suggestion above and it worked for you, kindly mark it as a solution else mark your response as a solution so that othe members can also benefit from it.

    Thank You