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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
How can I convert the table on the left (italic) to the one on the right (bold) using DAX only ?
| Entry | Doc No | Amount | Account | Doc No | Amount | Account | Amount Z | Account 2 | |
| 1 | X | 14 | A | X | 14 | A | 53 | Z | |
| 2 | X | 53 | Z | Y | 188 | A | 8 | Z | |
| 3 | Y | 67 | A | R | 88 | A | 54 | Z | |
| 4 | R | 17 | A | ||||||
| 5 | R | 71 | A | ||||||
| 6 | R | 54 | Z | ||||||
| 7 | Y | 99 | A | ||||||
| 8 | Y | 22 | A | ||||||
| 9 | Y | 4 | Z | ||||||
| 10 | Y | 4 | Z |
This is one of the things I've tried so far but with no luck
NewTable =
VAR _table1 =
CALCULATETABLE (
SUMMARIZE (
Table,
Table[Document No_],
Table[Account],
"Amount", SUM ( Table[Amount] )
),
Table[G_L Account No_] = "A"
)
VAR _table2 =
CALCULATETABLE (
SUMMARIZE (
Table,
Table[Document No_],
Table[Account],
"Amount", SUM ( Table[Amount] )
),
Table[G_L Account No_] <> "A"
)
RETURN
NATURALLEFTOUTERJOIN ( _table1, _table2 )
Hello @Yggdrasill ,
Try the following code:
NewTable =
ADDCOLUMNS(
CALCULATETABLE (
SUMMARIZE (
'Table',
'Table'[Doc No],
'Table'[Account],
"Amount", SUM ( 'Table'[Amount] )
);
'Table'[Account] = "A"
);
"Amount Z", CALCULATE ( SUM ( 'Table'[Amount] ), 'Table'[Account] <> "A" ),
"Account2", CALCULATE ( VALUES ( 'Table'[Account] ), 'Table'[Account] <> "A" )
)
Note that if you have more than one value for other non-Z accounts, VALUES will return an error, so you must place a MIN or MAX value or even a hard-coded value.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThe Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 63 | |
| 46 | |
| 42 | |
| 26 | |
| 19 |
| User | Count |
|---|---|
| 193 | |
| 124 | |
| 101 | |
| 67 | |
| 49 |