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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
MRN8840
Helper I
Helper I

Percent difference in visuals

Hi!

 

I have a page looking like this:

 

Percent.PNG

 

In the top and bottom section I can choose a week ('Uge i år') in a year ('År') and compare the consumption of electricity, water and heat.

 

How do a create a visual (card) which shows the difference in % between the top and bottom views?

 

In the example above I have chosen week 12 last year and this year. As you can see the difference is pretty big (thanks Corona... 😞 ).

 

-43,604 KWh (electricity)

-354 M3 (water)

-49 MWh (heat)

 

I work in the Facility Management at Aarhus University (Denmark), and I want to show how much we have 'powered down' our building due to corona.

 

Any hints?

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi  @MRN8840 

For your case, you'd better use this logic to create a last year measure to get it:

Last year = CALCULATE(SUM('Table'[electricity]),FILTER(ALL('Date'[Year]),'Date'[Year]=MAX('Table'[Year])-1))
Percent L/C = DIVIDE([Last year],CALCULATE(SUM('Table'[electricity])),0)

Result:

2.JPG

here is sample pbix file, please try it.

 

By the way, for the next year measure, you could try this logic:

Next year = CALCULATE(SUM('Table'[electricity]),FILTER(ALL('Date'[Year]),'Date'[Year]=MAX('Table'[Year])+1))

 

Regards,

Lin

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

View solution in original post

6 REPLIES 6
v-lili6-msft
Community Support
Community Support

hi  @MRN8840 

For your case, you'd better use this logic to create a last year measure to get it:

Last year = CALCULATE(SUM('Table'[electricity]),FILTER(ALL('Date'[Year]),'Date'[Year]=MAX('Table'[Year])-1))
Percent L/C = DIVIDE([Last year],CALCULATE(SUM('Table'[electricity])),0)

Result:

2.JPG

here is sample pbix file, please try it.

 

By the way, for the next year measure, you could try this logic:

Next year = CALCULATE(SUM('Table'[electricity]),FILTER(ALL('Date'[Year]),'Date'[Year]=MAX('Table'[Year])+1))

 

Regards,

Lin

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

You can use this year vs last year measure and find diff

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(('Date'[Date]),"12/31"))
This Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD((ENDOFYEAR('Date'[Date])),"12/31"))

Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
Last YTD complete Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))

 

use date calendar

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 :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

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

Hi @amitchandak!

 

I already have a date calender and it has been marked so in the model view. I have also joined it with the dataflow:

 

Connection.PNG

 

I have thought of using YTD, but will that change when I change the slection on the slicers?

Yes, In fact you keep one slicer and make both of the Work on this year last year

. If you want to use two. Use the 2020 slicer with change %. hopefully this is done using interactions

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
Mariusz
Community Champion
Community Champion

Hi @MRN8840 

 

Are the top and bottom slicers independent from each other or are these coming from the same table and you show different data by switching the interactions between visuals?

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Hi @Mariusz!

 

Thanks for your reply!

 

All the slicers come from the same date-table, but the two on the top only interact with the three top visuals and the two on the bottom only interact with the three bottom visuals.

 

So yes, I show different data by switching interactions on/off 🙂

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.