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! Request now

Reply
Anonymous
Not applicable

Table Wrong Totals

Hi All,

I have one column and two DAX measures to try to calcualte total number of flights. The rule is if the column [mode] equals "Grants" then (sum the tonnes and divde by 44) else 1.

 

ringovski_0-1616476773091.png

 

Correct answers are Blocks 23 and Grants 418 (417 rounded is fine). 

 

The calcuated column "Flight col" has the correct blocks but incorrect grants.

Measure Flights has correct blocks 23 and grants 417 but total is wrong.

Measure Flight 3 has correct grants and total but blocks should be 23.

 

Below is the syntax for the three columns.

 

Flights col = IF('Append1'[Mode] = "Grants",
'Append1'[Committed Tonnes] / 44,
1
)

Flights = SWITCH(
    SELECTEDVALUE(Append1[Mode])
    ,"Grants",SUMX(Append1,[New Cmt_Tons]/44)
    ,SUM(Append1[Days])
)

Flight 3 = 
VAR sumtable = ADDCOLUMNS(SUMMARIZE(Append1
                           ,Append1[Mode]
                           ,Append1[New Cmt_Tons]),
                           "cmt_Tons",
                           CALCULATE(sum(Append1[New Cmt_Tons])),
                           "block",
                           CALCULATE(SUM(Append1[Days]),FILTER(Append1,Append1[Mode]<>"Grants"))
)
RETURN
SUMx(sumtable, IF(Append1[Mode] = "Grants",[cmt_Tons]/44,[block]) 

 

I'm close but its not quite right, thanks for any assistance. 

 

Cheers

2 REPLIES 2
Anonymous
Not applicable

There's only two references, one is a alias for the table colum name.

 

Sample Data (there doesn't seem to be a way to attach csv or zips)
 

 

See screen shot of data.

 

Qatar DataQatar Data

 

 

 

 

 

 

 

 

 

 

 

 

 

I have fixed it by changing the column reference in the original calcuated column. But If anyone can tell me why Flight col works but Flights 3 doesn't?

 

New_Committed_Tonnes is a caluated column:

New Cmt_Tons = Append1[Committed Tonnes]/Append1[Days]

 

Works:

Flights col = IF('Append1'[Mode] = "Grants",
'Append1'[New Cmt_Tons] / 44,
1
)
 
Measure doesn't work:
Flight 3 =
VAR sumtable = ADDCOLUMNS(SUMMARIZE(Append1
,Append1[Mode]
,Append1[New Cmt_Tons]),
"cmt_Tons",
CALCULATE(sum(Append1[New Cmt_Tons]))
)
RETURN
SUMx(sumtable, IF(Append1[Mode] = "Grants",[cmt_Tons]/44,1)
 
flights.JPG
 
 
 
 
 
 
 
Thanks
lbendlin
Super User
Super User

You show three different fields for committed tons, and none of their data. Hard to tell without that.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.