cancel
Showing results for
Did you mean:
Regular Visitor

## 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?

7 REPLIES 7
Super User III

## Re: Problem calculated coloum vs measure

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

Regards

Miguel Felix

Proud to be a Datanaut!

Regular Visitor

## Re: Problem calculated coloum vs measure

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
Super User III

## Re: Problem calculated coloum vs measure

What do you mean by grouping? What is the result you want to.achieve?

Regards

Miguel Felix

Proud to be a Datanaut!

Regular Visitor

## Re: Problem calculated coloum vs measure

I would like to get a matrix where I can see the regroupment by parity. as the first field the calculation of the calculated parity column and by drilling down display the details of the stores.

Moderator

## Re: Problem calculated coloum vs measure

@Marcox28,

Calculated column will not response  to slicer selections, see https://community.powerbi.com/t5/Community-Knowledge-Base/Calculated-Column-Table-Change-Dynamically....

In your scenario, to make Parita dynamically change according to date slicer, you would need to create a measure, however, measure can't be dragged into Rows of Matrix, thus it is not possible to create the Matrix as you describe.

A workaround is to create a summarized table containing Parita measure, and then create Matrix visual using this summarized table, but in this case, Parita measure will act as a static column in the summarized table and it can't be changed dynamically.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Regular Visitor

## Re: Problem calculated coloum vs measure

Hello,
It is incredible that PowerBI does not have a variable management such as qlik and tableau, I hope it will be implemented soon.
Yesterday I tried to study an alternative to get the matrix I need.
I feel that I am close to the solution but my knowledge does not help me.
I try to explain my reason:
I created a table with three columns, date column, shop column and parity column with two values a and c.
for each store I entered the values of the whole calendar with values c for every day that the store was closed while for all the remaining days.
here is the table.

and these are the relationships

creating the matrix object I have only one problem:
when I select a given silgola everything works correctly, when instead selecting a range of data the stores are displayed both in group a and in group c.
is there a way to display it in group c if there is no value a and in group a if there is a value a?

Moderator

## Re: Problem calculated coloum vs measure

"is there a way to display it in group c if there is no value a and in group a if there is a value a?"

Could you please describe above requirement? Which table does the Ultime TNE_Descrizione field come from? What is your expected result based on the above sample data?

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Announcements

#### Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

#### Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

#### Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.