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! Request now

Reply
Anonymous
Not applicable

Average selected date by Count values

HI Team

I have 2 filter my report below

ff.PNG

I have table below format

DateCountry_NameCount
20-May-20INDIA20
20-May-20AMERICA10
20-May-20South africa30
21-May-20INDIA25
21-May-20AMERICA10
21-May-20South africa25
24-May-20INDIA30
24-May-20AMERICA10
24-May-20South africa34

 

IF User select 20-may-2020 to  26-may-2020 but data didnt avialble 23,25,26 dates

INDIA avaerage=(20+25+30)/3 =28.3( sum of count divided by No of data availlable date)

similar Amrica and South africa

 

please anybody help this

 

 

Thanks

Shanvitha

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

You can try measure like this:

average_count =
VAR RunningTotal =
    CALCULATE (
        SUM ( 'Table'[Count] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            SUMX (
                FILTER (
                    ( 'Table' ),
                    EARLIER ( 'Table'[Country_Name] ) = 'Table'[Country_Name]
                ),
                'Table'[Count]
            )
        )
    )
VAR distinct_day =
    CALCULATE ( DISTINCTCOUNT ( 'Table'[Date] ), ALLSELECTED ( 'Table' ) )
RETURN
    DIVIDE ( RunningTotal, distinct_day )

test_average_count.PNG

 

Best Regards,
Liang
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

5 REPLIES 5
amitchandak
Super User
Super User

@Anonymous , Simple Average should have done that, or do you want display against all dates, then you have to use all except : https://www.sqlbi.com/articles/using-allexcept-versus-all-and-values/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
parry2k
Super User
Super User

@Anonymous why you are not using simple average function in a measure 

 

Avg = AVERAGE ( Table[Count] )

 

In table visual, use country and above measure, and you will get the result.

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Hi Parrys

Thanks your replay.

I have given 3 column its working fine.

but I have 5 column its not working

 

DateCountry_NameCountBPIDRES/NON
20-May-20INDIA20Z10RES
20-May-20INDIA15Z12NONRES
20-May-20AMERICA10z12RES
20-May-20South africa30Z10RES
21-May-20INDIA25Z10RES
21-May-20INDIA25Z14RES
21-May-20AMERICA10Z12RES
21-May-20South africa25Z15NONRES
24-May-20INDIA30Z20NONRES
24-May-20INDIA34Z20RES
24-May-20AMERICA10Z35RES
24-May-20South africa34Z10NONRES

 

ABove table INDIA output =(20+15+25+25+30+34)/2=49.6

Please help on this

 

 

Thanks

Shnavitha

 

 

Hi @Anonymous ,

 

You can try measure like this:

average_count =
VAR RunningTotal =
    CALCULATE (
        SUM ( 'Table'[Count] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            SUMX (
                FILTER (
                    ( 'Table' ),
                    EARLIER ( 'Table'[Country_Name] ) = 'Table'[Country_Name]
                ),
                'Table'[Count]
            )
        )
    )
VAR distinct_day =
    CALCULATE ( DISTINCTCOUNT ( 'Table'[Date] ), ALLSELECTED ( 'Table' ) )
RETURN
    DIVIDE ( RunningTotal, distinct_day )

test_average_count.PNG

 

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

Anonymous
Not applicable

Thanks Vianl

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