cancel
Showing results for
Did you mean:
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?

1 ACCEPTED SOLUTION
Super User IV

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)``````

Proud to be a Super User!

4 REPLIES 4
Solution Sage

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

Frequent Visitor

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

Super User IV

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://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

Proud to be a Super User!

Super User IV

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)``````

Proud to be a Super User!

Announcements

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