cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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],

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

8 REPLIES 8
Resolver III

Hi @Analitika

Maybe try to do something like this:

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

Post 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],

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

Post Prodigy

Getting this error:

Resolver III

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

Post Prodigy

Hi, it also wrong:

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.

Resolver III

@Analitika

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

Post Prodigy

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

I use formula but it doesn't work.

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - June 2024

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

#### Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors
Top Kudoed Authors