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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
DYY94
Helper I
Helper I

Convert measure into a For loop with IF Condition

Hello Community, 

 

I want to to loop in this condition because it always gaves me '1' as a result.  

 

MR2 = 
Var mr365 = [MR/365] 
RETURN  
 IF ( mr365<1,1,mr365)
 
This is [MR/365] it's Measure: 
 
MR.PNG
4 REPLIES 4
Anonymous
Not applicable

Hi @DYY94 ,

 

Since I don't know how your [MR/365] metric was created, in the sample file on my side, it seems to be fine.

vstephenmsft_1-1671180536447.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.

Hi @Anonymous , 

 

Thanks for your reply ! 

 

Yes the code works fine like that but when i used it in other table it gave me always '1' for all columns.

cap.PNG

 

I have shared a simplified file to understand more the issue. 

https://drive.google.com/file/d/1ZgsfLABoWKLXWfuh-A3SslgmZmAd0c40/view?usp=sharing

Thanks.

amitchandak
Super User
Super User

@DYY94 , Try if this can help

 

MR2 =
Var mr365 = [MR/365]
RETURN
Sumx(Values(Table[Maturire]) , IF ( mr365<1,1,mr365))

 

 

If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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

Hi @amitchandak , 

 

Thanks for your help. 

the code works fine but when i used in other table it always gave me '1'. 

it should return the real number from [MR2]. 

 

cap.PNG 

Here a simplifed file to understand the issue. 

https://drive.google.com/file/d/1ZgsfLABoWKLXWfuh-A3SslgmZmAd0c40/view?usp=sharing

Thanks.

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors