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
SSS
Helper I
Helper I

Calculate Difference between days - weeks - months

Hi Fellas,

 

I need some help in order to accomplish one taks in power bi.

I need to calculate the difference between two periods of time and then show it in %, but these periods are not static but dynamic. I have a graphic where I can change from days, to weeks to months.

 

I have calculated a measure called SUM:

 

 

Sum = CALCULATE(SUM(Consulta1[ValuetoSum]);ALLEXCEPT(Table1Table1[Day];Table1[Month];Table1[Week]))

Now, in order to calculate the difference I find myself in the trouble. I know how to compute measures in order to make the difference for days, months, etc. using the functions PreviousDay, PreviousMonth, but I don't want to make three measures (one for day, one for week and one for month). What I need is a measure that computes the difference of the previous period.

 

For example, I'll put this measure in a line-graphic where the Axis is Month - Week - Day. If I am in "Day" I need the measure to compute the difference with the previous day, when I change to Week (going up in the graphic) I need the measure to compute the difference with the Previous Week, etc.

 

So I will be very grateful if anyone can help me, thanks guys.

3 REPLIES 3
v-chuncz-msft
Community Support
Community Support

@SSS,

 

You may use HASONEVALUE ( 'Calendar'[Date].[Day] ) in nested IF Function to add a measure.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi v-chuncz-msft,

 

can you explain it a little bit more? I am not able to reach to a solution with what you have said.

 

Thanks by the way!

@SSS,

 

I meant to use HASONEVALUE Function to detect the drill down level.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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