Forum Discussion

Analitika's avatar
Analitika
Icon for Post Prodigy rankPost Prodigy
4 years ago

Null value using measure in Power BI

Hello,

 

I would like to ask how to fix this. I wanted to calculate the change between years but getting null value, Formula looks like this:

mokLY = 
IF( HASONEVALUE(PARDAVIMAI[year]) ,CALCULATE ( [moketina_suma],
    DATEADD (PARDAVIMAI[SUTP_DATA],-1,YEAR ) ) )

this formula generates null it is not depending on which year I select.

8 Replies

  • Saap's avatar
    Saap
    Icon for Resolver III rankResolver III

    Hi Analitika 

    Maybe try to do something like this:

    SumLY = CALCULATE ([moketina_suma], SAMEPERIODLASTYEAR (PARDAVIMAI[SUTP_DATA]))

    • Analitika's avatar
      Analitika
      Icon for Post Prodigy rankPost Prodigy

      It is not what I am looking for. My point to get percent to see increase decrese comparing same period. So for this I used: 

      mokLY = 
      IF( HASONEVALUE(PARDAVIMAI[year]) ,CALCULATE ( [moketina_suma],
          DATEADD (PARDAVIMAI[SUTP_DATA],-1,YEAR ) ) )

       

      • Saap's avatar
        Saap
        Icon for Resolver III rankResolver III

        Analitika 

        You can still use my measure.

        Do something like this:

        Diff to last year % = DIVIDE ( [moketina_suma], [SumLY],0)-1

        This will show you the year over year percentage difference for the period you specify in a slicer.
        So if you choose full 2021 year it will show you the difference to full 2020.