Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Maikg
New Member

Help Required calculating current month vs January

Hello Everyone

 
Hoping someone can help me to get the right formula in power bi either power query or DAX for the following scenario:
I have an exchange rate table in which I need to calculate the variance of each month vs January.
Below is just an example with RUB currency of what result have to return but the table has more currencies on it.
 
I tried the below formula but is not giving the right result as the table has different currencies on it
 
ABS(CALCULATE(SUM('Month End Spot Rates'[CCY EUR]), FILTER('Month End Spot Rates','Month End Spot Rates'[Month]=1))-'Month End Spot Rates'[CCY EUR])
 

image.png

Maikg_1-1693836222920.png

 

1 ACCEPTED SOLUTION

Thank you for sharing 

 

January = CALCULATE(
    SUM('Table'[CCY EUR]),
    FILTER(ALLEXCEPT('Table','Table'[Currency]),'Table'[Month] = 1))

 

annonymous1999_1-1694086115183.png

@Maikg if i solved your uestion please consider accepting as solution adn leaving a kudos behind

 

View solution in original post

7 REPLIES 7
eliasayyy
Memorable Member
Memorable Member

in order to get only the month of jan for all columns , you need to remove all filters

in tables, a measur will use row context so in other words filter to the month name , 

so use calculate[rate],filter(all(table) , [month] = 1)) - [rate of month]

Thanks 
 
I tried above and below formula but still not getting the result I detailed in the excel as return value
 
Variance vs Jan = VAR JanuaryRate = CALCULATE(MAX('Month End Spot Rates'[CCY EUR]),FILTER('Month End Spot Rates',MONTH('Month End Spot Rates'[Date])=1)) return ABS('Month End Spot Rates'[CCY EUR])-JanuaryRate

 

and you need to use all inside the filter 

Variance vs Jan = VAR JanuaryRate = CALCULATE(MAX('Month End Spot Rates'[CCY EUR]),FILTER(ALL('Month End Spot Rates'),MONTH('Month End Spot Rates'[Date])=1)) return ABS('Month End Spot Rates'[CCY EUR]-JanuaryRate)

can you please hsrae sample dataset @Maikg 

Items.YearDateCurrencyMonthCCY EUR
202301/01/2023AED10.25106
202301/01/2023AMD10.00233
202301/01/2023RUB10.01311
202301/01/2023ALL10.00858
202301/02/2023RUB20.01258
202301/02/2023ALL20.00869
202301/02/2023AED20.25688
202301/02/2023AMD20.00243
202301/03/2023RUB30.01187
202301/03/2023AMD30.00235
202301/03/2023ALL30.00882
202301/03/2023AED30.24970
202301/04/2023AMD40.00233
202301/04/2023ALL40.00901
202301/04/2023AED40.24710
202301/04/2023RUB40.01114
202301/05/2023AMD50.00243
202301/05/2023RUB50.01153
202301/05/2023AED50.25484
202301/05/2023ALL50.00909
202301/06/2023ALL60.00938
202301/06/2023AMD60.00238
202301/06/2023AED60.25061
202301/06/2023RUB60.01046
202301/07/2023AED70.24722
202301/07/2023ALL70.00945
202301/07/2023AMD70.00235
202301/07/2023RUB70.00984

Thank you for sharing 

 

January = CALCULATE(
    SUM('Table'[CCY EUR]),
    FILTER(ALLEXCEPT('Table','Table'[Currency]),'Table'[Month] = 1))

 

annonymous1999_1-1694086115183.png

@Maikg if i solved your uestion please consider accepting as solution adn leaving a kudos behind

 

Thanks, yes this resolved part of the issue, I was able to use another formula to calculate the variance between months and January 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.