Forum Discussion

Saxon10's avatar
Saxon10
Icon for Post Prodigy rankPost Prodigy
5 years ago
Solved

Frequency based on the criteria

Hi,

 

How can I do frequence based on the criteria in Power BI using DAX.

 

I have a data table with information about the sales of products Id by customer with date.

 

What I`m trying to achieve here - How frequently we deliver the product id to the customer by date.

 

Data

 

Date Product IDCustomerQty
05/05/202112345Tata1
05/05/202112345Tata2
05/05/202112345Tata34
05/05/202112345Tata5
05/05/20211254Hero8
05/05/20211254Hero9
05/05/20211254Hero10
05/05/20211254Hero11
05/05/20211254Hero12
06/05/202112345Tata1200
06/05/20211254Honda1
06/05/20211254Honda1
06/05/20211254Honda1

 

 

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi  Saxon10 ,

    Here are the steps you can follow:

    1. Create measure.

    Sum =
    CALCULATE(SUM('Table'[Qty]),FILTER(ALL('Table'),'Table'[Customer]=MAX('Table'[Customer])&&'Table'[Date]=MAX('Table'[Date])))

     2. Result:

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  Saxon10 ,

    Here are the steps you can follow:

    1. Create measure.

    Sum =
    CALCULATE(SUM('Table'[Qty]),FILTER(ALL('Table'),'Table'[Customer]=MAX('Table'[Customer])&&'Table'[Date]=MAX('Table'[Date])))

     2. Result:

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Saxon10's avatar
      Saxon10
      Icon for Post Prodigy rankPost Prodigy

      Hi,

       

      Thank you so much for and reply. 

  • Anonymous's avatar
    Anonymous
    Not applicable

    To make it clear, can you post the expected output for the above given data?

     

    Thanks

    Raj