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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
ngadiez
Helper II
Helper II

Measure value is not right

I have a table with 2 columns [Duration] and [Duration within] both have value 1,2,3,4.

I also have a measure [Durations(Measure)] which get the selection from user.

 

Durations(Measure) = IF(HASONEVALUE('Duration'[Duration]),FIRSTNONBLANK('Duration'[Duration Within],1),1)

Capture.PNG

 

I want to use this measure for my other table column formula.

However, I cannot get the value correct when I write down the formula in this new column.

 

my [Durations(Measure)] measure has value 4, however, when I refer it inside my new column formula [DurationfrMeasureIndex], it is 1.

I am doing some debugging and found out the value of measure become 1.

Is there any problem with formatting?

 

DurationfrMeasureIndex = [Durations(Measure)]*12

 

 

 

 Capture.PNG

sa.PNG

Thank you

11 REPLIES 11
v-haibl-msft
Microsoft Employee
Microsoft Employee

@ngadiez

 

 

As Vvelarde said, calculated column can’t dynamically change its value. So we have to need to use measure to do the calculation.

I create a test table named YearTable like below. It has no relationship with the Duration table.

 

Measure value is not right_1.jpg

 

We can create a measure with following formula.

Checking =
VAR DM = [Durations(Measure)]
RETURN
    IF (
        COUNTROWS ( FILTER ( YearTable, YearTable[Year] <= DM ) )
            > 0,
        "Yes",
        "No"
    )

Measure value is not right_2.jpg

 

Best Regards,
Herbert

@v-haibl-msft

 

Thank you so much for the testing.

 

I have tried it and it's working.

 

However, I'm still trying how to incorporate this to mimic the same thing I want to achieve from calculated column. Because I want to do filtering based on the calculated column in DAX.

Anyway, thank you so much for your help.

 

@ngadiez

 

If it is woking, you can mark the right answer as solution, so that other users who have the same problem can find the solution quickly. 🙂

 

Best Regards,
Herbert

 

ngadiez
Helper II
Helper II

I have found the problem.

 

Even though, the measure shows the correct number when displayed as a card. 

However, when I pass the measure to calculated column formula, it is assumed to be false.

Why is it so?

Is there any other way so I can pass this to calculated column.

 

My guess:

Your measure works in a card, because in your report, you directly (or indirectly) apply a filter to your Duration table and HASONEVALUE(Duration[Duration]) returns true.

 

When evaluated in your calculated column, however, HASONEVALUE(Duration[Duration]) returns false, because the Duration table is not filtered, and your measure returns 1.

 

Can you provide a screenshot of your diagramm view, so we can see how your tables are related?

 

 

LaurentCouartou
Solution Supplier
Solution Supplier

Does the following work?

 

DurationfrMeasureIndex = CALCULATE( [Durations(Measure)]*12 )

No, it didn't work.

 

Capture.PNG

My guess is, your measure returns 1 because HASONEVALUE('Duration'[Duration]) returns false in your settings.

 

To help you further, we will need more details about your model.

 

Edit: Removed some misleading parts in my post.

 

 

 

What I want to achieve is to compare the measure with the other column.

Capture.PNG

Capture.PNG

@ngadiez

 

A measure couldn't be use as part of a creation of a Column. 

 

The columns not dinamically change of value.  the measure working in the context when was called.

 

 




Lima - Peru

Is there any other way to do this?

One thing is to use the parameter and filter the data from queries. 

However, I don't want this because it takes too long to load all the data when I change the parameters.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors