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
Solved! Go to Solution.
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.
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.
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.