Forum Discussion

samc_26's avatar
samc_26
Helper IV
1 year ago
Solved

New DAX table with count summary

Hi all, I'm trying to create a new table pulling through some data from an existing table (using a semantic model I don't have power query access to). The columns I want to use are the following:   ...
  • anilelmastasi's avatar
    1 year ago

    Hello samc_26 

     

    SUMMARIZE(...) creates a unique row for each Week Commencing + Area combo.

    ALLEXCEPT(...) removes filters on all other columns except Week Commencing and Area, allowing CALCULATE to count only the orders in that slice.

     

    Can you try this:

     

    Table =
    ADDCOLUMNS(
    SUMMARIZE(
    'Sales',
    'Sales'[Week Commencing],
    'Sales'[Area]
    ),
    "Total orders",
    CALCULATE(
    COUNT('Sales'[Order]),
    ALLEXCEPT('Sales', 'Sales'[Week Commencing], 'Sales'[Area])
    )
    )

  • mdaatifraza5556's avatar
    1 year ago

    Hi samc_26 

    Can you please try the below DAX ?

    Table =
    ADDCOLUMNS(
    SUMMARIZE('Sales', 'Sales'[Week Commencing], 'Sales'[Area]),
    "Total Orders", CALCULATE(
    COUNT('Sales'[Order]),
    ALLEXCEPT('Sales', 'Sales'[Week Commencing], 'Sales'[Area])
    )
    )


    If this answers your questions, kindly accept it as a solution and give kudos.