Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Dax Help

Hi,

 

I'm trying to acumulate the total orders per costumer in a fact table. An exemplo bellow:

 

 

How could i do that?

 

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous ,

    You can create a measure as below:

    Measure = 
    CALCULATE (
        COUNT ( 'Table'[order_date] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[id_store] = SELECTEDVALUE ( 'Table'[id_store] )
                && 'Table'[id_customer] = SELECTEDVALUE ( 'Table'[id_customer] )
                && 'Table'[id_product] = SELECTEDVALUE ( 'Table'[id_product] )
                && 'Table'[order_date] <= SELECTEDVALUE ( 'Table'[order_date] )
        )
    )

    Best Regards

2 Replies

  • Portrek's avatar
    Portrek
    Resolver III

    Hi.


    You can add a new table and put the dax below


    Table 2 = SUMMARIZE(Table,Table[id_costumer],Table[id_store],Table[id_product],"order",SUM(Table[Order]))

     

    best regards.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    You can create a measure as below:

    Measure = 
    CALCULATE (
        COUNT ( 'Table'[order_date] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[id_store] = SELECTEDVALUE ( 'Table'[id_store] )
                && 'Table'[id_customer] = SELECTEDVALUE ( 'Table'[id_customer] )
                && 'Table'[id_product] = SELECTEDVALUE ( 'Table'[id_product] )
                && 'Table'[order_date] <= SELECTEDVALUE ( 'Table'[order_date] )
        )
    )

    Best Regards