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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Rajendrabobade
Helper II
Helper II

Moving average of Distinct count of measure for each month uniquely.

Hello ,

 

In my  data i have  retailer code column , for calculation of moving average i need distinct count of retailers code so 

i am creating new  calculated  measure for the same like distinct count of retailer code .

 

When i am writing a dax for moving average of distinct count retailer that time my code is working but code taken distinct count mix values for all the month like . 

If april month i have Retailer code -Rts100 and my distinct count is 1 and agin for may month retailr code is same  - Rts100 and for this for distinct count is 1 so dax taken this as 1 becose we takn disticnt count ,but   i want output is = 1+1 =2 ,please help me .

 

below is my formula -

Moving Avg Retailercode = divide( CALCULATE(DISTINCTCOUNT(GRINetSalesDetailsBI[Retailer Code]),filter(allselected('Calendar'),'Calendar'[Date] <=max('Calendar'[Date]))) ,
CALCULATE(distinctcount('Calendar'[Month year]),filter(allselected('Calendar'),'Calendar'[Date] <=max('Calendar'[Date])), not(isblank((GRINetSalesDetailsBI[Retailer Code])))))
 
below is my sample data please help me to write dax .
Date                  Retailr code 
01-04-2020 0.00RTS061120
01-04-2020 0.00RTS061120
01-04-2020 0.00RTE371009
01-04-2020 0.00RT061120
01-04-2020 0.00RT581135
01-04-2020 0.00RT062480
01-04-2020 0.00RT581125
01-04-2020 0.00RT061120
01-04-2020 0.00RT062480
01-04-2020 0.00RT061172
01-04-2020 0.00RT062620
01-05-2020 0.00RT062620
01-05-2020 0.00RT062620
  
  
 
 

I want unique reatiler count of each month for moving avergae in my formula retrailr count is unique but whn i write dax that become a taken all month values unique count which is not corrcet we need each month disticn count values  to be show .

 

Thank you , Please help me .

 

 

 

3 REPLIES 3
Anonymous
Not applicable

Hi @Rajendrabobade ,

Thanks for your sharing. Could you please mark your reply as solution so that more people will benefit from it?

 

Best Regards,
Eyelyn Qin

Anonymous
Not applicable

Hi @Rajendrabobade ,

 

Not very clear... Could you please provide me with more details about your issue or expected output?

12.11.1.1.PNG

Here is the pbix file.

 

Best Regards,
Eyelyn Qin

Thank you for reply .

issue is resolved  for resolution we concatinate month and retailer code and put same measure into my formula .

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors