Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Analitika
Post Prodigy
Post Prodigy

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 8
Saap
Resolver III
Resolver III

Hi @Analitika 

Maybe try to do something like this:

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

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 ) ) )

 

@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.

Getting this error:

Analitika_0-1656415792798.png

 

In SAMEPERIODLASTYEAR function use the date column from your date table instead of PARDAVIMAI[SUTP_DATA].

Hi, it also wrong:

Analitika_0-1656416545212.png

 

All time diff is -1. But sum is different in 2021 and 2022 years. I also checked that there is a relationship between date and table2 tables. But getting wrong answer.

 

@Analitika 

Maybe try to post some sample data and expected result.
It would be easier to work on.

Expected result that I could percents how sales increased or decresed per period.

I use formula but it doesn't work.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors