Forum Discussion
Calculate Slope based on Filters (same Field) PowerBI/DAX
Hi,
i want to calcualte the sloe ( (v1-v2) /v2) but like more dynamically in PowerBI. The User can/should select 2 Filters (FY) and it should show the value, which is filtered by Regions - ask anything if you need more informations. Table/Matrix looks like this:
"Imagin correct and not blank values"
DimRegion (RegionName) , DimDate (YearLabel), DimTransactions (Value)
- Anonymous1 year ago
Hi KLBR
Based on your description, You can refer the follwing sample.
Sample data.
Data Table.
Date table
Region Table.
Relationship
Create a measure
MEASURE = VAR a = CALCULATE ( SUM ( Data[Value] ), OFFSET ( -1, ALLSELECTED ( DimDate[Year] ), ORDERBY ( [Year], ASC ) ) ) RETURN DIVIDE ( a - CALCULATE ( SUM ( Data[Value] ) ), CALCULATE ( SUM ( Data[Value] ) ) )Then put the following field to a matrix visual.
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
1 Reply
- AnonymousNot applicable
Hi KLBR
Based on your description, You can refer the follwing sample.
Sample data.
Data Table.
Date table
Region Table.
Relationship
Create a measure
MEASURE = VAR a = CALCULATE ( SUM ( Data[Value] ), OFFSET ( -1, ALLSELECTED ( DimDate[Year] ), ORDERBY ( [Year], ASC ) ) ) RETURN DIVIDE ( a - CALCULATE ( SUM ( Data[Value] ) ), CALCULATE ( SUM ( Data[Value] ) ) )Then put the following field to a matrix visual.
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.