Forum Discussion
matdub40
Helper III
5 years agoHow to calculate the difference between two values in different years?
I have a date table that contains these columns: I use a "Euro Gross Amount" measure in a matrix on Power BI: I would like to calculate the difference on the Euro Gross betw...
- 5 years ago
Try this:
DIFF =
DIVIDE (
[Euro Gross Amount]
- CALCULATE ( [Euro Gross Amount], SAMEPERIODLASTYEAR ( 'date'[date] ) ),
CALCULATE ( [Euro Gross Amount], SAMEPERIODLASTYEAR ( 'date'[date] ) ),
0
)And convert this measure to a percentage in Measure Tools section
PC2790
Community Champion
5 years agoTry this:
DIFF =
DIVIDE (
[Euro Gross Amount]
- CALCULATE ( [Euro Gross Amount], SAMEPERIODLASTYEAR ( 'date'[date] ) ),
CALCULATE ( [Euro Gross Amount], SAMEPERIODLASTYEAR ( 'date'[date] ) ),
0
)
DIVIDE (
[Euro Gross Amount]
- CALCULATE ( [Euro Gross Amount], SAMEPERIODLASTYEAR ( 'date'[date] ) ),
CALCULATE ( [Euro Gross Amount], SAMEPERIODLASTYEAR ( 'date'[date] ) ),
0
)
And convert this measure to a percentage in Measure Tools section
matdub40
Helper III
5 years agoHello PC2790 ,
Since this morning I have an error on my measurement "Evo%" which tells me
"MdxScript(Prod_WS_RCE_Order_SKU) (145, 44) Calculation error in measure 'dwh_d_order_sku'[Evo %]: The 'SAMEPERIODLASTYEAR' function expects a contiguous selection when the date column comes from a table on side 1 of a bidirectional relationship. "
Is this normal or should I change something?