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 in Power BI using measure

Hello,

 

Having issue with sales comparing this year last year in percentage. I created a measure but getting null values somehow.

 

 

mok_ly = 
IF( HASONEVALUE('Date'[Metai]) ,CALCULATE ( [moketina_suma],
    DATEADD ('Date'[Date],-1,YEAR ) ) )​

 

 

Analitika_0-1656492307513.png

How to resolve this issue?
3 REPLIES 3
v-stephen-msft
Community Support
Community Support

Hi @Analitika ,

 

You may modify your measure as 

mok_ly = 
IF( HASONEVALUE('Date'[Metai]) ,1,0 )​

Then put it in your visual and see if it returns 1 or 0.

And also add a measure as folllows into the visual to check if it returns the results.

CALCULATE ( [moketina_suma],
    DATEADD ('Date'[Date],-1,YEAR ) )

 

The above two actions might help you see which part is going wrong.

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

selimovd
Super User
Super User

Hey @Analitika ,

 

did you mark you date table as date table?

Otherwise you have to add an ALL('Date') to the CALCULATE.

 

Did you check if HASONEVALUE('Date'[Metai]) is true? So if the CALCULATE will be executed?

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍

Best regards
Denis

Blog: WhatTheFact.bi
Follow me: twitter.com/DenSelimovic

Yes,

 

Date table is used in that measure. Date[Metai] means Date[Year], I see is true 

Analitika_0-1656494181201.png

Metai is one value.

@selimovd 

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.