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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Analitika
Post Prodigy
Post Prodigy

Error in calculating rate in Power BI

Hi,

 

I am having this issue. I tried creating this measure but getting error:

 

 

 

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

 

When I put this measure in visual, getting this error:

Analitika_0-1656400770597.pngAnalitika_1-1656400796623.png

I am getting this error message. So how to resolve this error?

 

 

10 REPLIES 10
amitchandak
Super User
Super User

@Analitika , You should always use date table joined with date of your table

 

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

 

Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5b...
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I tried still not working. I also made a relationship between date table and my table. But stil not working.

Analitika_0-1656403373483.png

 

 

Anonymous
Not applicable

Hi @Analitika ,

 

As far as I know, DATEADD() will return a table that contains a column of dates, shifted either forward or backward in time by the specified number of intervals from the dates in the current context. Due to you add a table into measure which should return a single value, you will get an error as above.

mokLY = 
IF( 
HASONEVALUE( PARDAVIMAI[year]) ,
CALCULATE ([moketina_suma],
DATE(YEAR(MAX(PARDAVIMAI[SUTP_IRASO_DATA]))-1,MONTH(MAX(PARDAVIMAI[SUTP_IRASO_DATA])),DAY(MAX(PARDAVIMAI[SUTP_IRASO_DATA])))
)

 

Best Regards,
Rico Zhou

 

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

Ok. I solved it. Please help me with this issue. I am getting this whenever I publish it in Power BI.

Analitika_0-1656670404268.png

 

Hi,

 

I am facing issue when getting wrong measure. I wanted to calculate growth of sales per year. Here is a measure:

 

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

When I put measure in table, I am getting null value.

Analitika_0-1656567852217.png

 

I have made a relationship between tables Date and Pardavimai. Measure [moketina_suma] is from Pardavimai table.

 

Here is a relationship:

 

Analitika_1-1656567952956.png

So how to resolve this issue?

Hi,

 

I have this issue:

 

I created a measure but it gives me null value. How to  fix it?

 

Here how looks visual:

Analitika_0-1656580187545.png

It shows null value.

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

 

Analitika_1-1656580279537.png

Relationship between tables.

 

Here is a measure:

 

 

 

 

It could be a number of reasons. Please will you try these two test measures. Please put both of them into the visual and post here a screenshot of the result.

 

Test1 = CALCULATE ( [moketina_suma], DATEADD ('Date1'[Date],-1,YEAR )
Test2 = IF( HASONEVALUE('Date1'[Metai]) , "true", "false" )

 

Hi,

 

Having issue with measure:

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

 

Getting this error:

Analitika_0-1656484847819.png

Full dax formula:

BP pardavimai DK+-50 pokytis_mok % = DIVIDE([moketina_suma]-[mok_ly],[mok_ly]).
So how to fix it?

Hi,

 

I would like to ask why I am getting null values in visual if there is a relationship between Pardavimai and Date table.

Measure looks like this: 

 

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

 

Analitika_0-1656498748141.png

null, even I selected years.

Hi,

 

I would like to ask why it happens that I am getting null if I connected Pardavimai and Date. But when calculating rate and put it in visual see null column.

 

Analitika_0-1656507178325.png

third column is null.

 

Why this happens?

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

Analitika_1-1656507356135.png

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors