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
Anonymous
Not applicable

Matrix to show previous day and MTD performance of the metrics

Hi All, is there any way we can achieve the below view in Power BI matrix visual or for that matter any other custom visual?

 

ExampleExample

 

When i add date and month in rows or in columns it shows drill down options, which is not what i am looking for.

Can someone please suggest how can i do this?

 

Thank you

5 REPLIES 5
v-eqin-msft
Community Support
Community Support

Hi @Anonymous ,

You could firstly create a table for Matrix visual’s row ,and then use the following formula.

 

Or take a look at  my pbix file  here.

Flag =
VAR _previous =
    CALCULATE ( MAX ( 'Table'[Date] ) - 1, ALL ( 'Table' ) )
RETURN
    IF (
        DATEDIFF ( 'Table'[Date], _previous, DAY ) = 0,
        "6-Sep",
        IF ( MONTH ( 'Table'[Date] ) = 9, "MTD Sep", BLANK () )
    )
Measure =
SWITCH (
    MAX ( ForMatrix[Martix rows] ),
    "6-Sep", SUMX ( FILTER ( 'Table', 'Table'[Flag] = "6-Sep" ), [Num] ),
    "MTD Sep",
        SUMX (
            FILTER ( 'Table', 'Table'[Flag] = "6-Sep" || 'Table'[Flag] = "MTD Sep" ),
            [Num]
        )
)

My visualizations look like this:

9.8.2.1.png

Did I answer your question ? Please mark my reply as solution. Thank you very much.

If not, please upload some insensitive data samples and expected output.

 

Best Regards,

Eyelyn Qin

Anonymous
Not applicable

@v-eqin-msft thank you for the detailed answer. However, I think I forgot to mention that the A, B, C etc are the calculated measures which are used in the values and hence can't create a table as you have shown.

amitchandak
Super User
Super User

@Anonymous , You can get previous day and MTD using time intelligence and Date table. You Display is Matrix Show on Row

 

Day

This Day = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Date]=max('Date'[Date])))
Last Day = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Date]=max('Date'[Date])-1))
Last Day = CALCULATE(sum('order'[Qty]), previousday('Date'[Date]))

 

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))

 

Date Table -https://youtu.be/Qt0TM-4H09U

 

Display - USe show on row - refer https://www.burningsuit.co.uk/blog/2019/04/7-secrets-of-the-matrix-visual/

 

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/

See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184


Appreciate your Kudos.

Anonymous
Not applicable

@amitchandak I will try this out. That would mean I would have to create two measures for each metric right? 

 

With respect to my example above, there would be a a measure for previous day A and MTD A, previous day B and MTD B and so on?

 

Also if I do this would I get a view as shown in my example? Because my example shows column name as metrics and in rows I have date and month, but after putting values in rows I would not get metrics as my column names. Is my understanding right?

Greg_Deckler
Super User
Super User

@Anonymous - Check out Measure Totals the Final Word as you can have a different calculation for the Total line versus row. 

https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907#M239

 

Also, see MM3TR&R - https://community.powerbi.com/t5/Quick-Measures-Gallery/Matrix-Measure-Total-Triple-Threat-Rock-amp-Roll/m-p/411443#M150


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.