cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Psholka
Frequent Visitor

Show the difference of values on matrix rows

Hi, help me pls with this issue

I have a list of different Measures like Revenue, Traffic, average price... (of course, I use different tables for calculation).

And I need to show it in a table like this. 

The main problem is to show the difference, I can show measures in rows, but that's it...

Is there any possibility?

Thank you in advance!! 

 

download.png

 

1 ACCEPTED SOLUTION

You can also try

 

This week sales = 
var _date = date(year(today()),month(today()),day(today()))
var _Week_ED = _date + (-1*WEEKDAY(_date)+1)
var _Week_SD= _date +(7-1*WEEKDAY(_date))

Return 
CALCULATE(sum(Sales[Sales Amount]),all('Date'),Sales[Sales Date]>=_Week_SD && Sales[Sales Date]<=_Week_ED)


Last week sales = 
var _date = date(year(today()),month(today()),day(today()))
var _Week_ED = _date +( (-1*WEEKDAY(_date)+1)-7)
var _Week_SD= _date +((7-1*WEEKDAY(_date))-7)

Return 
CALCULATE(sum(Sales[Sales Amount]),all('Date'),Sales[Sales Date]>=_Week_SD && Sales[Sales Date]<=_Week_ED)


Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

4 REPLIES 4
kentyler
Solution Sage
Solution Sage

In this article Matt Allington gives step by step instructions https://exceleratorbi.com.au/measures-on-rows-here-is-how-i-did-it/

 

Its not something you can do natively in Power BI, but he shows a great work around

 

I'm a personal Power Bi Trainer I learn something every time I answer a question. I blog at http://powerbithehardparts.com/

The Golden Rules for Power BI

  1. Use a Calendar table. A custom Date tables is preferable to using the automatic date/time handling capabilities of Power BI. https://www.youtube.com/watch?v=FxiAYGbCfAQ
  2. Build your data model as a Star Schema. Creating a star schema in Power BI is the best practice to improve performance and more importantly, to ensure accurate results! https://www.youtube.com/watch?v=1Kilya6aUQw
  3. Use a small set up sample data when developing. When building your measures and calculated columns always use a small amount of sample data so that it will be easier to confirm that you are getting the right numbers.
  4. Store all your intermediate calculations in VARs when you’re writing measures. You can return these intermediate VARs instead of your final result  to check on your steps along the way.




Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


Psholka
Frequent Visitor

Thank you for your answer.

The main problem is to show the difference between 2 perions - the last column.

Create a date table and join all the tables with that.

 

For week you use current measure and lag measure

 

Week behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-7,Day))
Week Sales = CALCULATE(SUM(Sales[Sales Amount]))

 

The above will work if you have week in date dimesnion

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/

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

You can also try

 

This week sales = 
var _date = date(year(today()),month(today()),day(today()))
var _Week_ED = _date + (-1*WEEKDAY(_date)+1)
var _Week_SD= _date +(7-1*WEEKDAY(_date))

Return 
CALCULATE(sum(Sales[Sales Amount]),all('Date'),Sales[Sales Date]>=_Week_SD && Sales[Sales Date]<=_Week_ED)


Last week sales = 
var _date = date(year(today()),month(today()),day(today()))
var _Week_ED = _date +( (-1*WEEKDAY(_date)+1)-7)
var _Week_SD= _date +((7-1*WEEKDAY(_date))-7)

Return 
CALCULATE(sum(Sales[Sales Amount]),all('Date'),Sales[Sales Date]>=_Week_SD && Sales[Sales Date]<=_Week_ED)


Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

Helpful resources

Announcements
MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Top Solution Authors
Top Kudoed Authors