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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
tim10
Helper I
Helper I

Dax works in measure but not in column

Hello

 

I have 2 tables:

a) one is a disconnected table with a list of years : 2020, 2021, 2022.

In this one i have a measure with this code:

Selected RY = selectedvalue('Reporting Year'[ReportingYear])

 

b) one is a table with periods

In this one i have a measure with this code:

 

CY0 Delayed =
var yeartoday=year(today())

return
SWITCH(true(),
month(today())=2 && day(today())<=[Hide Show Day], yeartoday-1,
month(today())=1, yeartoday-1
,yeartoday
)

 

I've also built one column and one measure that have identical code. They can be found in this archive: Link 

If i put these 2 in a table, the measure shows everything correctly while the column does not.

Could you please guide me to understand why this is happening? Thank you

 

compare.png

 

 

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

Measures and calculated columns are pretty different:

https://radacad.com/measure-vs-calculated-column-the-mysterious-question-not

 

In addition to the whole row context vs filter context thing, a calculated column cannot read slicer values since it's only calculated once each time the model is initially loaded or refreshed, not in response to user interactions via slicers or filters.

 

 

View solution in original post

2 REPLIES 2
v-henryk-mstf
Community Support
Community Support

Hi @tim10 ,

 

As @AlexisOlson  said, there are some differences between a calculated column and a measure.


The calculated column is an extension of the table calculated for each row, and the general grouping filter uses the EARILER function more frequently.

Measure is handled differently than any other table column. Unlike calculated columns, measure is dynamically evaluated with each change in context. If the date filter is changed from 2019 to 2020, all measures will be calculated again. additionally measures are intended to be used as aggregates. Each calculated measure must contain an aggregation function, such as AVG or SUM. if there is no aggregation function, the formula for the measure will show an error.

You can refer to the following blogs to deepen your understanding of both.

Power BI Tutorial: When to Use Calculated Columns and Measures (insightsoftware.com)


If the problem is still not resolved, please point it out and provide test data. Looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

AlexisOlson
Super User
Super User

Measures and calculated columns are pretty different:

https://radacad.com/measure-vs-calculated-column-the-mysterious-question-not

 

In addition to the whole row context vs filter context thing, a calculated column cannot read slicer values since it's only calculated once each time the model is initially loaded or refreshed, not in response to user interactions via slicers or filters.

 

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors