Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Month Count Frequency

Hello everyone.

 

This is my first post so I'll try to question clearly my doubt. 

 

I want to count the frequency an item has been sold throughout the year. 

In this example:

I want to build up a DAX to get the 'MONTH_COUNT' as a frequency. 

Prod1 has been sold in Jan,Mar and Apr. So 3/4 = 75%

So on and so forth.

 

Its not important the quantity, just if It was sold or not and count how many times during the year (Jan-Dec).

 

Thanks in advance

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi  Anonymous ,

    I created some data:

    Here are the steps you can follow:

    1. Create measure.

    Count_Month_Group =
    CALCULATE(COUNT('Table'[group]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])&&'Table'[group]=MAX('Table'[group])))
    MONTH_COUNT =
    CALCULATE(DISTINCTCOUNT('Table'[Month]),FILTER(ALL('Table'),'Table'[group]=MAX('Table'[group])))
    Count_all = CALCULATE( DISTINCTCOUNT('Table'[Month]),ALL('Table'))
    Divide =
    IF(
       ISINSCOPE( 'Table'[Month]),
       [Count_Month_Group],
    FORMAT( DIVIDE([MONTH_COUNT],[Count_all]),"Percent"))

    2. Open the matrix vision object.

    3. 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

     

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  Anonymous ,

    I created some data:

    Here are the steps you can follow:

    1. Create measure.

    Count_Month_Group =
    CALCULATE(COUNT('Table'[group]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])&&'Table'[group]=MAX('Table'[group])))
    MONTH_COUNT =
    CALCULATE(DISTINCTCOUNT('Table'[Month]),FILTER(ALL('Table'),'Table'[group]=MAX('Table'[group])))
    Count_all = CALCULATE( DISTINCTCOUNT('Table'[Month]),ALL('Table'))
    Divide =
    IF(
       ISINSCOPE( 'Table'[Month]),
       [Count_Month_Group],
    FORMAT( DIVIDE([MONTH_COUNT],[Count_all]),"Percent"))

    2. Open the matrix vision object.

    3. 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

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you very much for the solution Anonymous . It worked pretty well here and solved my problem!

      Thanks for sharing the pbix 

       

      Best regards