Forum Discussion
Power BI Year Over Year analysis using the matrix visual
- 3 months ago
Hi LondiweNkosi,
Thanks for reaching fabric community, You can perform below steps to calculate %chnage by selecting the slicers.
1) Relationship should be like between your sales and date table.2) Create measures
- GP = SUM ( SalesData[GP] )- GP Previous Year =CALCULATE ([GP],SAMEPERIODLASTYEAR ( 'Date'[Date] ))- GP YoY % =DIVIDE ( [GP] - [GP Previous Year], [GP Previous Year] )3) Matrix visual format should be like this
Just want to conform you need YOY % chnage is that correct?
Please consider as an accepted solution if helps or give some kudos.
sample table I createdSalesData = DATATABLE ( "Customer", STRING, "Date", DATETIME, "GP", INTEGER, { { "DTX", "2023-03-01", 1825000 }, { "DTX", "2024-03-01", 1745623 }, { "Ftech", "2023-03-01", 2325460 }, { "Ftech", "2024-03-01", 1014587 }, { "Clicks", "2023-03-01", 985625 }, { "Clicks", "2024-03-01", 1003265 }, { "Joe Soap", "2023-03-01", 114522 }, { "Joe Soap", "2024-03-01", 256341 } } )Date = ADDCOLUMNS ( CALENDAR ( DATE ( 2023, 1, 1 ), DATE ( 2024, 12, 31 ) ), "Year", YEAR ( [Date] ), "Month Name", FORMAT ( [Date], "MMM" ), "Month Number", MONTH ( [Date] ), "Year Month", FORMAT ( [Date], "MMM yyyy" ) )
Hi LondiweNkosi
This seems like a good use case for visual calculations. It will be the quickest and easiest option for you.
Click the 3 dots in the top right of the matrix visual, select 'New visual calculation', 'Custom'
In the formula bar, add:
DIVIDE (column2, column1)
Click accept and go back to the report.
Open the format pane/properties and expand 'data format'
Select your new visual calculation column and format as percentage
--------------------------------
I hope this helps, please give kudos and mark as solved if it does!
Connect with me on LinkedIn.
Subscribe to my YouTube channel for Fabric/Power Platform related content!