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
leandrocsouza
Frequent Visitor

Replace value in visual table

The last column (marked in red) of the table is determined by the value of the yellow column minus the value of the green column

 

leandrocsouza_0-1673622304508.png

 

 

And I need to replace the value of this last column with 0 if the result is negative. I tried with the following DAX formula, and it worked when it has only one row in the table

 

IF(CALCULATE(SUM(ft_repasse[saldo]) < 0), 0, SUM(ft_repasse[saldo]))

 

leandrocsouza_1-1673622304512.png

 

but when there are two or more rows in table, the total goes wrong.

 

leandrocsouza_2-1673622304514.png

 

 

The total should be $ 2,416,069.97 because the second row (that actual value is $ -1,154,717) should be replaced by 0.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@leandrocsouza , try like

 

Sumx(sumamrize(ft_repasse[UF], ft_repasse[Orago APRENSOR]), CALCULATE(IF(SUM(ft_repasse[saldo]) < 0, 0, SUM(ft_repasse[saldo]))))

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

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@leandrocsouza , try like

 

Sumx(sumamrize(ft_repasse[UF], ft_repasse[Orago APRENSOR]), CALCULATE(IF(SUM(ft_repasse[saldo]) < 0, 0, SUM(ft_repasse[saldo]))))

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

 it worked for me, 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