Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
I have a matrix visual with several columns per Plan ID. I'm trying to add one more DAX measure/column that will sum the values in the Comp Amount column for each Child Component, per Parent Component. The pic below is kinda oversimplified (and I did it in Excel just for dispay purposes) but it gets the idea across. The circled column in the pic here is what I'm wanting to add. You can see that for each Parent Component there are multiple Child Components. I just need one more column with total PER Parent Component...PER Plan ID. So there could be more PLan IDs listed here with the same type of look. Below are some of the expressions I've tried to no avail. I'm sure I'm just missing something small. Thanks!
FYI - the POS_NEG_AMOUNTS value in the DAX expression below are the amount values I have in my table (ex: -500, 200.75, -1033.48, etc.).
Solved! Go to Solution.
Hi @turp111 ,
You can create a measure or calculated column as below to get it, please find the details in the attachment.
Create a calculated column:
Column =
VAR _mincid =
CALCULATE (
MIN ( 'Breakdown Table (plancomcycledtl)'[Child Comp ID] ),
FILTER (
ALLSELECTED ( 'Breakdown Table (plancomcycledtl)' ),
'Breakdown Table (plancomcycledtl)'[Plan ID]
= EARLIER ( 'Breakdown Table (plancomcycledtl)'[Plan ID] )
&& 'Breakdown Table (plancomcycledtl)'[Parent Component]
= EARLIER ( 'Breakdown Table (plancomcycledtl)'[Parent Component] )
)
)
VAR _pamount =
CALCULATE (
SUM ( 'Breakdown Table (plancomcycledtl)'[Comp Amount] ),
FILTER (
ALLSELECTED ( 'Breakdown Table (plancomcycledtl)' ),
'Breakdown Table (plancomcycledtl)'[Plan ID]
= EARLIER ( 'Breakdown Table (plancomcycledtl)'[Plan ID] )
&& 'Breakdown Table (plancomcycledtl)'[Parent Component]
= EARLIER ( 'Breakdown Table (plancomcycledtl)'[Parent Component] )
)
)
RETURN
IF ( 'Breakdown Table (plancomcycledtl)'[Child Comp ID] = _mincid, _pamount )
Create a mesaure:
Parent Amount =
VAR _pid =
SELECTEDVALUE ( 'Breakdown Table (plancomcycledtl)'[Plan ID] )
VAR _parentcmp =
SELECTEDVALUE ( 'Breakdown Table (plancomcycledtl)'[Parent Component] )
VAR _ccid =
SELECTEDVALUE ( 'Breakdown Table (plancomcycledtl)'[Child Comp ID] )
VAR _mincid =
CALCULATE (
MIN ( 'Breakdown Table (plancomcycledtl)'[Child Comp ID] ),
FILTER (
ALLSELECTED ( 'Breakdown Table (plancomcycledtl)' ),
'Breakdown Table (plancomcycledtl)'[Plan ID] = _pid
&& 'Breakdown Table (plancomcycledtl)'[Parent Component] = _parentcmp
)
)
VAR _pamount =
CALCULATE (
SUM ( 'Breakdown Table (plancomcycledtl)'[Comp Amount] ),
FILTER (
ALLSELECTED ( 'Breakdown Table (plancomcycledtl)' ),
'Breakdown Table (plancomcycledtl)'[Plan ID] = _pid
&& 'Breakdown Table (plancomcycledtl)'[Parent Component] = _parentcmp
)
)
RETURN
IF ( _ccid = _mincid, _pamount )
Best Regards
Hi @turp111 ,
You can create a measure or calculated column as below to get it, please find the details in the attachment.
Create a calculated column:
Column =
VAR _mincid =
CALCULATE (
MIN ( 'Breakdown Table (plancomcycledtl)'[Child Comp ID] ),
FILTER (
ALLSELECTED ( 'Breakdown Table (plancomcycledtl)' ),
'Breakdown Table (plancomcycledtl)'[Plan ID]
= EARLIER ( 'Breakdown Table (plancomcycledtl)'[Plan ID] )
&& 'Breakdown Table (plancomcycledtl)'[Parent Component]
= EARLIER ( 'Breakdown Table (plancomcycledtl)'[Parent Component] )
)
)
VAR _pamount =
CALCULATE (
SUM ( 'Breakdown Table (plancomcycledtl)'[Comp Amount] ),
FILTER (
ALLSELECTED ( 'Breakdown Table (plancomcycledtl)' ),
'Breakdown Table (plancomcycledtl)'[Plan ID]
= EARLIER ( 'Breakdown Table (plancomcycledtl)'[Plan ID] )
&& 'Breakdown Table (plancomcycledtl)'[Parent Component]
= EARLIER ( 'Breakdown Table (plancomcycledtl)'[Parent Component] )
)
)
RETURN
IF ( 'Breakdown Table (plancomcycledtl)'[Child Comp ID] = _mincid, _pamount )
Create a mesaure:
Parent Amount =
VAR _pid =
SELECTEDVALUE ( 'Breakdown Table (plancomcycledtl)'[Plan ID] )
VAR _parentcmp =
SELECTEDVALUE ( 'Breakdown Table (plancomcycledtl)'[Parent Component] )
VAR _ccid =
SELECTEDVALUE ( 'Breakdown Table (plancomcycledtl)'[Child Comp ID] )
VAR _mincid =
CALCULATE (
MIN ( 'Breakdown Table (plancomcycledtl)'[Child Comp ID] ),
FILTER (
ALLSELECTED ( 'Breakdown Table (plancomcycledtl)' ),
'Breakdown Table (plancomcycledtl)'[Plan ID] = _pid
&& 'Breakdown Table (plancomcycledtl)'[Parent Component] = _parentcmp
)
)
VAR _pamount =
CALCULATE (
SUM ( 'Breakdown Table (plancomcycledtl)'[Comp Amount] ),
FILTER (
ALLSELECTED ( 'Breakdown Table (plancomcycledtl)' ),
'Breakdown Table (plancomcycledtl)'[Plan ID] = _pid
&& 'Breakdown Table (plancomcycledtl)'[Parent Component] = _parentcmp
)
)
RETURN
IF ( _ccid = _mincid, _pamount )
Best Regards
Hae you tried calculate sum of amount filtering all (child IDs) ??
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 6 | |
| 6 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 21 | |
| 12 | |
| 9 | |
| 5 | |
| 5 |