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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Marcox28
Helper II
Helper II

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.DWH.jpg

 

 

DWHTab2.jpg

 

DWHTab1.jpg

 

 

DWHTab3.jpg

 

Can you explain me why this formula give me two different result?

Thank in advance!

 

 

7 REPLIES 7
MFelix
Super User
Super 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:

 

column_measur.gif

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Thanks 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

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

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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.esempio.JPG

 

@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.

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.

tabella parità.JPG

 

 

 

 

and these are the relationshipsrelazioni.JPG

 

 

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?

multipla data.JPG

 

singola data.JPG

 

 

 

@Marcox28,

 

"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.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.