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

Filtered Sum in calculated column

Hello all,

 

I have what i feel should be easy problem to solve but my DAX isn't working.  I have a table that I would like to add a column that returns the sum of a column filtered.  Can I do that?

MonthRegionZoneMarketCustomerOrders (for month)  Total Orders (Market)Ratio
JanTexasTexas - NorthDallasBob's ER551.0

Jan

TexasTexas - SouthHoustonTom's ER512.42
JanTexasTexas - SouthHoustonFirst ER712.58
FebTexasTexas - NorthDallasBob's ER810.8

Feb

TexasTexas - NorthDallasNice ER210.8
FebTexasTexas - SouthHoustonFirst ER551.0
1 ACCEPTED SOLUTION
ilooper
Frequent Visitor

I figured it out through measure.  The only problem is I can't (yet) roll up through the hierachy becasue of the filter context.

 

Total Patients (Market/Month) =
Var Market1 = SELECTEDVALUE(Invoice_Table_Master[Market])
Var Month1 = SELECTEDVALUE(Invoice_Table_Master[Month])

Return
CALCULATE(SUM(Invoice_Table_Master[Patient Count on Inv.]),
Invoice_Table_Master[Market] = Market1,
Invoice_Table_Master[Month] = Month1,
ALL(Invoice_Table_Master))
 
 

View solution in original post

3 REPLIES 3
ilooper
Frequent Visitor

I figured it out through measure.  The only problem is I can't (yet) roll up through the hierachy becasue of the filter context.

 

Total Patients (Market/Month) =
Var Market1 = SELECTEDVALUE(Invoice_Table_Master[Market])
Var Month1 = SELECTEDVALUE(Invoice_Table_Master[Month])

Return
CALCULATE(SUM(Invoice_Table_Master[Patient Count on Inv.]),
Invoice_Table_Master[Market] = Market1,
Invoice_Table_Master[Month] = Month1,
ALL(Invoice_Table_Master))
 
 
ilooper
Frequent Visitor

Thanks for your help! It doesn't look like the dax for the Total Patients (Market) is working it is suming all.  What do you think? data2.jpg

jdbuchanan71
Super User
Super User

@ilooper 

You can write the following measures to get your values.

Order Amount = SUM ( 'Table'[Orders (for month)] )
Total Orders (Market) = 
CALCULATE ( 
    [Order Amount],
    ALLEXCEPT ('Table','Table'[Month],'Table'[Market] )
)
Ratio = 
DIVIDE ( [Order Amount], [Total Orders (Market)] )

jdbuchanan71_0-1648784306826.png

 

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.

Top Solution Authors