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
Bebs
Helper II
Helper II

How to put a filter from calculate parameter in a variable (measure) ?

Hello,

I've several quite simple DAX aggregations measures such as :

EXPENSES_2022=CALCULATE(measures[EXPENSES], data[YEAR]=2022)

 

I'd like to use a "variable" instead of 2022 which can be shared between several measures and evolve automatically when we have year changes, so I created a measure :

YEAR_N = MAX(data[YEAR])

 

I tried this :

EXPENSES_MAX=CALCULATE(measures[EXPENSES], data[YEAR]=global_VARIABLES[YEAR_N])

I got an error message (something talking about PLACEHOLDER instead of boolean value ...).

 

on the forum, I found something about adding filter function So , my new formula became :

EXPENSES_MAX=CALCULATE(measures[EXPENSES], FILTER(data,data[YEAR]=global_VARIABLES[YEAR_N]))

technically, I've a result, but the calculation gives me much more data (I don't understant yet where it comes from). Do you know what consequences the use of FILTER can have in the calculation (suppressing others filters etc ...)

 

regards

1 REPLY 1
daXtreme
Solution Sage
Solution Sage

Before you start creating calculations, you should read something upon CALCULATE: Introducing CALCULATE in DAX - SQLBI

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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