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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
tnwcloud
Regular Visitor

Substitute value when filtered

I have a dataset where some Items are members of a Group. For Groups, one Item is designated Type of Parent and the others, if any, are designated Type of Child. Each Item not in a Group carries an Amount. For Groups, only the Parent carries the Amount, however there is a Display Amount field that shows the Amount against each Child Item members of Groups. A correct Total of Amount would be SUM(Amount), while a SUM(Display Amount) would overcount.

 

I need a measure that sums Amount but works even if the Parent item is filtered out via a slicer or a user selection. Effectively I need to Sum the Amount column, but if a specific Child is selected I need to subsitute the Display Amount. If a selection filters out the Parent but includes more than one Child I need to use the distinct Amount for the Group.

 

I've tried playing around with VALUES and DISTINCT but I haven't found a solution that works for both Group and non-Group items.

 

ItemGroupTypeAmountDisplay Amount
1AParent33
2AChild 3
3AChild 3
4BParent55
5BChild 5
6BChild 5
7CParent33
8CChild 3
9CChild 3
10null 77
11null 55
12null 22

 

1 ACCEPTED SOLUTION
bot_damo
Frequent Visitor

Hi @tnwcloud,

I think the following DAX will work here.

CALCULATE(SUM('Table'[Amount]), ALLEXCEPT('Table', 'Table'[Group]))

Kind Regards



View solution in original post

2 REPLIES 2
tnwcloud
Regular Visitor

Wow I was really over thinking that one!

bot_damo
Frequent Visitor

Hi @tnwcloud,

I think the following DAX will work here.

CALCULATE(SUM('Table'[Amount]), ALLEXCEPT('Table', 'Table'[Group]))

Kind Regards



Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.