Forum Discussion

Anon46's avatar
Anon46
Frequent Visitor
3 years ago
Solved

Aggregated table with various column aggregations

Hi all,   Sorry if there have been similar asks in the past but cant find the exact solution that I am looking for 🙂   I am trying to create a new aggregated table based on a specific value wher...
  • Jihwan_Kim's avatar
    Jihwan_Kim
    3 years ago

    Hi,

    I am not sure if I understood your question correctly, but could you please try the below?

     

    New AGG Table =
    SUMMARIZE (
        FILTER (
            ADDCOLUMNS (
                SUMMARIZE ( 'Order', 'Order'[Order], 'Order'[Color], 'Order'[Date] ),
                "@CountOrders", CALCULATE ( COUNTROWS ( 'Order' ) ),
                "@AvgHrs", CALCULATE ( AVERAGE ( 'Order'[Hours] ) ),
                "@Date", FORMAT ( 'Order'[Date], "mmm yy" ),
                "@Period",
                    IF (
                        'Order'[Date] >= DATE ( 2022, 2, 1 )
                            && 'Order'[Date] <= DATE ( 2022, 3, 31 ),
                        "P1",
                        "P2"
                    ),
                "@PeriodGoal",
                    IF (
                        'Order'[Date] >= DATE ( 2022, 2, 1 )
                            && 'Order'[Date] <= DATE ( 2022, 3, 31 ),
                        "<=3",
                        "<=4"
                    )
            ),
            'Order'[Order] = "A"
        ),
        'Order'[Color],
        [@CountOrders],
        [@AvgHrs],
        [@Date],
        [@Period],
        [@PeriodGoal]
    )