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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
austinb97
Regular Visitor

Formula in measure not working as expected

Hi, 

 

I have attached images and labelled 4 measures below and the resulting output. Measure 1 and 2 are related, and measure 3 and 4 are related. Measure 1 and 3 are similar and measure 2 and 4 are similar, but I am trying to determine why measure 4 is returning a blank when measure 2 works correctly. Does it have to do with filter context? All of them work except for Measure 4. 

 

Measure 4 (Does Not Work):

Measure 4 - Does Not Work.png

 

Measure 3 (Works Correctly):

Measure 3 - Works Correctly.png

 

Measure 2 (Works Correctly):

Measure 2 - Works Correctly.png

 

Measure 1 (Works Correctly):

Measure 1 - Works Correctly.png

 

 

6 REPLIES 6
v-luwang-msft
Community Support
Community Support

Hi @austinb97 ,

Try to adjust your measure4:

Price Setter(Wish Asset removal)=
calculate(min(Meritorder[Price],
Filter(all(MeritOrder),MeritOrder[Cumulative Available MW]>>=[Fake Dispatched Available MW]))

 

Since I don't have your specific file, I use a similar model:

see the below:

vluwangmsft_3-1630042161868.png

 

Return(test2) is blank:(Incorrect)

vluwangmsft_2-1630042151286.png

return test:(correct)

vluwangmsft_4-1630042263060.png

 

When I add all to filter:(correct value)

vluwangmsft_5-1630042325965.png

 

refer :all

 

If question still not solved ,could you pls share your pbix file?

 

 


Don't forget to give thumbs up and accept this as a solution if it helped you!!!

 

Best Regards

Lucien

AlexisOlson
Super User
Super User

Yes. It's likely due to filter context complications.

 

If you expect [Fake Dispatched Available MW] to be the same value for each row you are iterating over in the FILTER, then the solution is simple; calculate it once rather than for each row:

Price Setter (With Asset Removal) =
VAR Fake = [Fake Dispatched Available MW]
RETURN
    CALCULATE (
        MIN ( MeritOrder[Price] ),
        FILTER ( MeritOrder, Fake <= MeritOrder[Cumulative Available MW] )
    )

 

If the measure should be dependent on the row context from the FILTER iterator, then things get more complicated.

Thanks, however this does not appear to fix my issue with the BLANK getting returned. I just can't understand why Measure 2 works correctly and Measure 4 does not with essentially the same logic. 

What if you replace [Fake Dispatched Available MW] with the hardcoded value 8953? Do you get a non-blank or are you just filtering out the whole table?

 

Note: You are playing with fire having ALLSELECTED inside of a FILTER iterator. ALLSELECTED is really complicated to understand in such situations.

I appreciate the suggestion. You can see the result below, it does work as expected in this case. There is just some sort of issue with how the measure is being passed into this formula. When its hardcoded in, then it works. Any idea how to rewrite my "Measure 3" from above? You are probably correct that its the ALLSELECTED causing the issue. Basically I am using a slicer to choose an "AssetName" then I want it to sum the corresponding "Available MW" and pass it into my "Measure 4"

 

Image.png

It's doesn't make sense to me why this works but my initial suggestion doesn't if 8953 is the result of a working Measure 3.

 

Does anything change if you use VALUES instead of ALLSELECTED? If you don't have filter context from the visual (e.g. rows/column in a matrix), these should behave similarly.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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