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
CharlotteCity12
Microsoft Employee
Microsoft Employee

Division is not working

PBII have a Metric Column.

If Metric Column = 1 then sum amount 1 column,
if metric column = 2 then sum amount 2 column,
if metric column = 3 then sum amount 3 column and divide by sum of Div column

 

Totals11 = sum(main[Amount1])

Totals22 = sum(main[Amount2])

Totals33 = sum(main[Amount3])

DivTotal = SUM(main[Div])

divcoln = SUM(main[Amount3])/SUM(main[Div])

 

mainfield = IF(main[Metric]=1,[Totals11],IF(main[Metric]=2,[Totals22],IF(main[Metric]=3,[divcoln],0)))

 

 On a chart the MainField column is summing metric 3

 

See PBI Chart:

divsum.JPG

1 ACCEPTED SOLUTION

@dannio

 

You should have the [Totals] measure divided by [DivTotals].

 

mainfield = IF(main[Metric]=3,[Totals]/main[DivTotals],[Totals])

56.PNG

 

Regards,

View solution in original post

4 REPLIES 4
v-sihou-msft
Microsoft Employee
Microsoft Employee

@CharlotteCity12

 

In this scenario, it's much better to use a calculated column to include different value based on Metric in your main table instead of creating multiple measures. Just add a calculated column like below:

 

Amount = SWITCH(main[Metric],1,main[Amount1],2,main[Amount2],3,main[Amount3],BLANK())

Then you just need to create one measure to sum above column.

 

Totals = SUM(main[Amount])

Your mainfield can be like:

 

mainfield = IF(main[Metric]=3,[Totals]/[DivTotal],[Totals])

 

Regards,

Simon Hou

 

 

 

It is not working as I need.

 

Amount = SWITCH(main[Metric],1,main[Amount1],2,main[Amount2],3,main[Amount3],BLANK())

 

Totals = SUM(main[Amount])

 

mainfield = IF(main[Metric]=3,[Totals]/[DivTotal],[Totals])

 

Same issue as orginal post

'

See link to PBIX:

https://1drv.ms/u/s!AvFqXklXcyRRg_F5uq_9jWgtSZCnug

link to PBIX

 

 

 

@dannio

 

You should have the [Totals] measure divided by [DivTotals].

 

mainfield = IF(main[Metric]=3,[Totals]/main[DivTotals],[Totals])

56.PNG

 

Regards,

tringuyenminh92
Memorable Member
Memorable Member

Hi @CharlotteCity12,

 

Could i have your sample data file to check in my local?

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