Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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:

RodrigoBSC_0-1638472543648.png

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

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1638760811026.png

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.

vyangliumsft_1-1638760811030.png

3. Result:

vyangliumsft_2-1638760811032.png

 

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

 

View solution in original post

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1638760811026.png

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.

vyangliumsft_1-1638760811030.png

3. Result:

vyangliumsft_2-1638760811032.png

 

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
Not applicable

Thank you very much for the solution @v-yangliu-msft . It worked pretty well here and solved my problem!

Thanks for sharing the pbix 

 

Best regards

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.