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
Hi!
I have a table that follows this structure:
| ID | Balance | Type | Date |
| 111 | 10 | A | 20/10/2025 |
| 111 | 20 | M | 30/10/2025 |
| 222 | 5 | A | 02/12/2025 |
| 222 | 3 | B | 01/09/2024 |
| 333 | 40 | M | 23/11/2024 |
| 333 | 30 | M | 27/05/2025 |
| 333 | 21 | A | 21/09/2025 |
| 444 | 9 | B | 17/03/2025 |
I want to create a new calculated table based on the original that displays distinct IDs, sum of Balance for each ID, columns with the count of rows for each type, and the maximum date for each ID and type.
The end result would be a table like this:
| ID | Balance | Count (Type A) | Max Date (Type A) | Count (Type B) | Max Date (Type B) | Count (Type M) | Max Date (Type M) |
| 111 | 30 | 1 | 20/10/2025 | 0 | 1 | 30/10/2025 | |
| 222 | 8 | 1 | 02/12/2025 | 1 | 01/09/2024 | 0 | |
| 333 | 71 | 1 | 21/09/2025 | 0 | 2 | 27/05/2025 | |
| 444 | 9 | 0 | 1 | 17/03/2025 | 0 |
How can I do this?
Solved! Go to Solution.
Hey,
try to make a calculated table with this dax
SummaryByID :=
ADDCOLUMNS(
SUMMARIZE(
'Fact',
'Fact'[ID],
"Balance", CALCULATE(SUM('Fact'[Balance]))
),
// Type A
"Count (Type A)", CALCULATE(COUNTROWS('Fact'), 'Fact'[Type] = "A"),
"Max Date (Type A)", CALCULATE(MAX('Fact'[Date]), 'Fact'[Type] = "A"),
// Type B
"Count (Type B)", CALCULATE(COUNTROWS('Fact'), 'Fact'[Type] = "B"),
"Max Date (Type B)", CALCULATE(MAX('Fact'[Date]), 'Fact'[Type] = "B"),
// Type M
"Count (Type M)", CALCULATE(COUNTROWS('Fact'), 'Fact'[Type] = "M"),
"Max Date (Type M)", CALCULATE(MAX('Fact'[Date]), 'Fact'[Type] = "M")
)
Hi,
If you are OK with a measure based solution, then write these measures
Total = sum(Data[Balance])
C = calculate(countrows(Data),data[type]="A")
D = max(Data[Date])
Hope this helps.
Hey,
try to make a calculated table with this dax
SummaryByID :=
ADDCOLUMNS(
SUMMARIZE(
'Fact',
'Fact'[ID],
"Balance", CALCULATE(SUM('Fact'[Balance]))
),
// Type A
"Count (Type A)", CALCULATE(COUNTROWS('Fact'), 'Fact'[Type] = "A"),
"Max Date (Type A)", CALCULATE(MAX('Fact'[Date]), 'Fact'[Type] = "A"),
// Type B
"Count (Type B)", CALCULATE(COUNTROWS('Fact'), 'Fact'[Type] = "B"),
"Max Date (Type B)", CALCULATE(MAX('Fact'[Date]), 'Fact'[Type] = "B"),
// Type M
"Count (Type M)", CALCULATE(COUNTROWS('Fact'), 'Fact'[Type] = "M"),
"Max Date (Type M)", CALCULATE(MAX('Fact'[Date]), 'Fact'[Type] = "M")
)
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.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 48 | |
| 40 | |
| 37 | |
| 20 | |
| 15 |
| User | Count |
|---|---|
| 70 | |
| 67 | |
| 32 | |
| 27 | |
| 25 |