Forum Discussion
Difference between 2 columns in Matrix
Hi, I have the following Matrix and I would like to add another column with the difference between the rates of the 2 different periods columns (201803 & 201802), these 2 columns are from the same column (Reporting Period), when I connect to the data source I only bring the latest 2 periods (Direct Query). Could you please help me out.
HI Manar
Try this one
Measure = CALCULATE ( SUM ( ExchangeRatesFacts[ExchangeRate] ), FILTER ( ALL ( ExchangeRatesFacts[ReportingPeriod] ), ExchangeRatesFacts[ReportingPeriod] = [CurrentReportingPeriod] ) ) - CALCULATE ( SUM ( ExchangeRatesFacts[ExchangeRate] ), FILTER ( ALL ( ExchangeRatesFacts[ReportingPeriod] ), ExchangeRatesFacts[ReportingPeriod] = [LastReportingPeriod] ) )
11 Replies
- Zubair_MuhammadCommunity Champion
HI Manar
Try a MEASURE along following lines
Measure = CALCULATE ( SUM ( TableName[Rates] ), TableName[ReportingPeriod] = 201803 ) - CALCULATE ( SUM ( TableName[Rates] ), TableName[ReportingPeriod] = 201802 )- ManarHelper II
I tried using your formula just added a measure instead of reporting period since they change every month
Measure = CALCULATE ( SUM ( ExchangeRatesFacts[ExchangeRate] ), ExchangeRatesFacts[ReportingPeriod] = CurrencyDim[CurrentReportingPeriod] )
- CALCULATE ( SUM ( ExchangeRatesFacts[ExchangeRate] ), ExchangeRatesFacts[ReportingPeriod] = CurrencyDim[LastReportingPeriod])and it gives me an error saying a function Calculate has been used in a true/false expression that is used as a table filter expression, This is not allowed.
- Zubair_MuhammadCommunity Champion
- AnonymousNot applicable
What about if we have year more than 2 like 2015 , 2016 ,2017 ,2018 , 2019, 2020