Forum Discussion
ramasaurio
2 years agoFrequent Visitor
How to use aggregation on coalesced columns?
I'm trying to use the function COALESCE to fill in missing values in a column. Doing that was simple but when I try to use the values of that new measure, the aggregations show values as if it were ...
- 2 years ago
Hi ramasaurio
If the logic is to coalesce at the date level, I would write measures as follows:
Value A Sum = SUM ( 'Table A'[value_A] )Value B Sum = SUM ( Table_B[value_B] )coalesce_measure by date = SUMX ( VALUES ( dates[date] ), -- dates would also work COALESCE( [Value A Sum], [Value B Sum] ) )Does this work for you?
OwenAuger
Super User
2 years agoHi ramasaurio
If the logic is to coalesce at the date level, I would write measures as follows:
Value A Sum =
SUM ( 'Table A'[value_A] )Value B Sum =
SUM ( Table_B[value_B] )coalesce_measure by date =
SUMX (
VALUES ( dates[date] ), -- dates would also work
COALESCE( [Value A Sum], [Value B Sum] )
)
Does this work for you?
- ramasaurio2 years agoFrequent Visitor
This worked perfectly.
I think I understand why this solution works, I'm making a table based on the values of column "date" of table dates, and then calculating the value of each row coalescing the measures of values A and B. But may I ask why my initial approach doesn't work? I'm fairly new to Power BI so I'm proabably missing some basic concept as to how measures work.
Thanks!