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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
mtstewart17
Frequent Visitor

How do I make a Measure constant to use in a Custom Column calculation

Hello,

 

I have a dataset that has columns for Year and the Week Number. I have a measure [MAX WEEK] that finds the maximum week number for the current year. I have checked and this measure correctly evaluates to 41 which is the max week from my data.

 

Max Week = max(Table1[Week_Num])

 

I try to use this measure to find rows with a Week Number equal to the MAX WEEK measure with the following custom column formula. 

 

IN MAX WEEK? = if(Table1[Week_Num] = [MAX WEEK], "Yes","No")

 

In theory I should be able to use this column as a filter on my visuals to only see data for the last week, but it is not filtering anything. It seems like the measure MAX WEEK is evaluating at the row level when used in my custom column so it returns "Yes" for every row.

 

Is there any way to make sure my measure always returns the same value? Or to find the max of a column and reference it as a constant?

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

Max Week = CALCULATE(max(Table1[Week_Num]),ALL(Table1))


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

Max Week = CALCULATE(max(Table1[Week_Num]),ALL(Table1))


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Worked perfectly! Thanks!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.