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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Analitika
Post Prodigy
Post Prodigy

Null rate in Power BI

Hi,

 

Getting issue. I wanted to count rate comparison this year last year in sales. But getting null values, no idea why it happens?

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

[moketina_suma] measure is generated from table called Pardavimai. I made a relationship between Date and Pardavimai but getting:

 

Analitika_0-1656487727475.png

Even I selected  this year and still null values. Why it happens?

 

Here is a picture of relationship:

Analitika_1-1656487877470.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @Analitika,

Perhaps you can try to use the date function to manually define the filter range for calculation.

mok_ly =
VAR currDate =
    MAX ( 'Date'[Date] )
RETURN
    CALCULATE (
        [moketina_suma],
        FILTER (
            ALLSELECTED ( 'Fact' ),
            'Fact'[Date]
                = DATE ( YEAR ( currDate ) - 1, MONTH ( currDate ), DAY ( currDate ) )
        ),
        VALUES ( 'Date'[Metai] )
    )

Notice: replace the 'fact' table with the table your 'moketina_suma' formula is calculated.
Regards,

Xiaoxin Sheng

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

HI @Analitika,

Perhaps you can try to use the date function to manually define the filter range for calculation.

mok_ly =
VAR currDate =
    MAX ( 'Date'[Date] )
RETURN
    CALCULATE (
        [moketina_suma],
        FILTER (
            ALLSELECTED ( 'Fact' ),
            'Fact'[Date]
                = DATE ( YEAR ( currDate ) - 1, MONTH ( currDate ), DAY ( currDate ) )
        ),
        VALUES ( 'Date'[Metai] )
    )

Notice: replace the 'fact' table with the table your 'moketina_suma' formula is calculated.
Regards,

Xiaoxin Sheng

Analitika
Post Prodigy
Post Prodigy

Hi,

 

I would like to ask why it happens that has one value generates blank values. Here is a measure:

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

 

Analitika_0-1656508311045.png

Here is a blank third column which uses measure above.

 

Here is a relationship between Pardavimai and Date tables.

Analitika_1-1656508387843.png

 

So how to solve my issue?

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.