Forum Discussion

nok's avatar
nok
Icon for Advocate II rankAdvocate II
10 months ago
Solved

Create a table with unique IDs and calculations based on the original table

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 4...
  • Gabry's avatar
    10 months ago

    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")
    )