Forum Discussion
Problem calculated coloum vs measure
Hi I'm trying to insert a measure in my power bi solution with the same syntax of a previusly created calculated column.
The behavior of the two formulas is slightly different and I do not know why.
I have two tables, the first is a data dimension table and the second is a fact table joined together.
On the data dimension table I have created a measure like this:
StartDate = CALCULATE(MIN(DimData[DataFormattata]);ALLSELECTED(DimData[DataFormattata]))
Then I've created the calculated column with this formula:
Parita = if (min(Negozi[TNE_DataApertura])<=[StartDate];"Parità";"NoParità")
and a Measure (Called MisParita) with the same formula.
When I create a matrix (with some of these columns and the two incriminated formulas on a power bi sheet I see that the results are different.
Can you explain me why this formula give me two different result?
Thank in advance!
7 Replies
- MFelixSuper User
Hi Marcox28,
First of all you need t understand that measures and calculated columns are different, the main difference is the evaluation context of each one.
Check this link were you have a explanation and some examples for each one and how you the react depending on context.
Looking at your case you can't filter a calculated column based on a measure since the context of the column will be different on the measure you are filtering, so when you aplly it to a column it will give odd result.
Making a simple test you can check that the measure you use for the calculted column his always giving you the minimum date of the tableand not the one in the filter. When you add it to a measure it wil give you the expectet change based on the slicer check the example below:
Regards,
MFelix
- Marcox28Helper IIThanks for the reply
I can not understand how I can get a grouping in a Matrix using a calculated column that works like the measure you showed me.
Keeping in mind that I need to use as minimum date the minimum value selected in the data slider- MFelixSuper UserWhat do you mean by grouping? What is the result you want to.achieve?