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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
mmace1
Impactful Individual
Impactful Individual

Summing a filtered version of a table, using only the unique values (Virtual Tables Question?)

The situation is easy to solve via Power Query, but I'd love to know how to do this in DAX. 

 

Say I have the below table:

 

Capture.JPG

 

I want to sum the Spend column: SUM(Spend)

Only when RuleviolationID = 7:  CALCULATE(SUM(SPEND), RuleViolationID = 7)

 

So that's all very simple. 


But see how the PaymentIDs have duplicates?  I only want to sum the Spend 1x per each instance of a PaymentID. 

 

I was thinking of using CALCLUATETABLE to pull a version of the table where RuleViolationID = 7, And then using VALUES to only grab unique values of the PaymentID, but - obviously that doesn't work.  It makes me think virtual tables would be the way to go, though. 

 

It's easy to just pull a custom version of the table in Power Query, but is there a good way to work this in DAX? 

 

 

 

2 REPLIES 2
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @mmace1 

 

You may try to create a table with SUMMARIZE Function. For example:

 

Table =
SUMMARIZE (
    FILTER ( Table1, Table1[RuleViolationID] = 7 ),
    Table1[PaymentID],
    "Spend", SUM ( Table1[Spend] )
)

Regards,

Cherie

 

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks - wouldn't summarize by the paymentID, result in duplicate payment IDs being counted more than 1x though? 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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