cancel
Showing results 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.

Anonymous
Not applicable

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

1 ACCEPTED SOLUTION
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)``````
4 REPLIES 4
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

Anonymous
Not applicable

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

Super User

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

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

Announcements

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

#### Power BI Monthly Update - April 2024

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

#### Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors