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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Using a measure into Calculate+Filter VS using a constant equal to my measure

Hi, 

 

I'm running some test to set my (pretty simple) measure but there is a thing that I dont understand. 

 

When I use : 

Version1 = 
2 + CALCULATE(sum(FORECAST[Forecast]),filter(FORECAST,FORECAST[position]<=2))

My result is correct.

The constant 2 (used 2 times) is actually the result of another measure X. And I confirm that when I check the result of this measure, it is 2.

 

And when I use : 

Version2 = 
X + CALCULATE(sum(FORECAST[Forecast]),filter(FORECAST,FORECAST[position]<=X))

The result is not correct.

I'm sure that the first X is correctly interpreted as a 2, but not the 2nd one. 

 

I don't understand this and i'm not able to find the logic used to find the same result than the machine.

Do you think the use of X inside Calculate + filter changes somehow the meaning of the calculation ?

 

Thank you for your help

 

 

3 REPLIES 3
Anonymous
Not applicable

Thanks for your answer, but actually I have completely changed my datamodel, and I.m not exposed to this problem anymore.... I guess I did something bad in my first datamodel. 

Thank you guys for having tried to help.

Anonymous
Not applicable

Hi @Anonymous ,

 

If your metric is placed in a view with multiple fields, the results will be affected by rows, as in the following simple example.

x = CALCULATE(sum(FORECAST[Forecast]),filter(FORECAST,FORECAST[position]=2))

Screenshot 2021-05-04 173407.png

 

If you want the x measure to return the same result in all rows, add the ALL function.

x = CALCULATE(sum(FORECAST[Forecast]),filter(ALL(FORECAST),FORECAST[position]=2))

3.png

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

amitchandak
Super User
Super User

@Anonymous , As a measure, is calculated at each row and grand total level. Your calculation will change based on that

 

You need to use some kind group

Version2 =
sumx(values(FORECAST[columns]), X + CALCULATE(sum(FORECAST[Forecast]),filter(FORECAST,FORECAST[position]<=X)))

 

change columns to with group by you want in visual

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.