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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

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
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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