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
Anonymous
Not applicable

assign measure value to calculated column

I have created two tables:

 

a1.PNGa2.PNG

User can see green field as slicer in sheet and on select, i have created measure in id_indicator table,

Measure 5 = if(COUNTROWS('Input_Threshold') = 1, sum('Input_Threshold'[Green]), BLANK())

I want to assign ([measure 5]  * [by_hour]) to field calculated but it is not working, giving black (I tried calculated = [measure 5] but still not working)

Is it possibe to assign measure value to calculated column? 

2 ACCEPTED SOLUTIONS
Phil_Seamark
Employee
Employee

Hi @Anonymous,

 

PRobably not as a calculated column but you can do it as a calculated measure and you will probably get the result you are after, in that as you dynamically change the slicer selection your new calcuated meaure will reflect the values

 

So try putting this measure on your main table and then create a matrix visual

 

New Measure = 'Input_Threshold'[Measure 5] * [Measure 5]

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

Hi @Anonymous,

 

>>so calculated column requires, is it possible with calculated measure to do for each indicator?

Current, power bi not support use slicer value to work with calculate column.

You should use measure to instead the calculate column.

 

Regards,

Xiaoxin SHeng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

7 REPLIES 7
andrewporter
Advocate I
Advocate I

I realize this is an old post, but the thought of appending a measure to a table as a calculated column signals to me a significant misunderstanding about the difference between calculated columns, measures, and Context in DAX queries.

 

Calculated Columns operate in the context of the current row i.e. "Row Context". Sure you can play around with CALCULATE, FILTER, etc. but it is a value that pertains to that particular row of data before it has been rolled up / aggregated as a part of a measure.

 

In order to be actually meaningful, Measures (aggregates of many rows column values) operate against two more contexts in addition to the Row Context; Filter Context and Query Context.

 

I tend to think of DAX Context like an onion.

 

Filter Context -> Measures know about this

Query Context -> Measures know about this

Row Context -> Measures and Calculated Columns know about this

 

If you do add a Measure as a Calculated Column, it will be the SAME for every Calculated column because no Query or Filter Context applies. I do not believe this is what you want.

 

To solve, as @v-shex-msft pointed out, you will need to create a new Measure that references your old measure in order to accomplish this since you want to still live on that "aggregate" level, not the row.

 

Here is some reading, I had to read this page 10 times and I'm still not sure I fully understand DAX Contexts.

 

MSDN Context in DAX Formulas

If you do add a Measure as a Calculated Column, it will be the SAME for every Calculated column because no Query or Filter Context applies. I do not believe this is what you want

 

Not necessarily. If a relationship exists between the table with the calculated column and another table, then context transition will occur and you'll get a different result for every row

Yes! In fact! I need it :c

How can make it? 

Hi @andrewporter

 

In facts i need it.. is possible use a measur in column calculated?

For example. In a report  I have a Parameter but in my column calculated the parameter is factor of a value in other column (the problem is very complicated that it obviously) and don't can use measure.

Phil_Seamark
Employee
Employee

Hi @Anonymous,

 

PRobably not as a calculated column but you can do it as a calculated measure and you will probably get the result you are after, in that as you dynamically change the slicer selection your new calcuated meaure will reflect the values

 

So try putting this measure on your main table and then create a matrix visual

 

New Measure = 'Input_Threshold'[Measure 5] * [Measure 5]

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Anonymous
Not applicable

Hi @Phil_Seamark,

 

Thanks for replying, yes it is possible to use it as calculate measure,

 

What is want is for each id_indicator calculated column would be different as value would be different.

 

if measure 5 is 50. (user select 50 as slicer value)

 

id_indicator    hour   calculated column

1                        9       50*9

1                       10      50*10

.........upto ............20      50*20

2                       9        50*9

2                       10      50*10

......upto......20.......

..for 1000 id_indicator

 

so calculated column requires, is it possible with calculated measure to do for each indicator?

Thanks.

 

Hi @Anonymous,

 

>>so calculated column requires, is it possible with calculated measure to do for each indicator?

Current, power bi not support use slicer value to work with calculate column.

You should use measure to instead the calculate column.

 

Regards,

Xiaoxin SHeng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help 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.