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
JUSEGAPO
Regular Visitor

¿How i can calculate average of total tickets by date to show in table?

Dear all,

 

I need help to can calculate average of qty of tickets by date and show in a table with some filters: 

 

So, i have it data:

 

TICKETPLANDATECATEGORYTYPE
6-00000819PLAN 12017-07-06COMBUSTIBLEADITIONAL
6-00000810PLAN 32017-07-06MAYBE COMBUSTIBLEADITIONAL
6-00000802PLAN 32017-07-06COMBUSTIBLEADITIONAL
6-00000797PLAN 22017-07-06COMBUSTIBLE 
6-00000791PLAN 32017-07-06NO COMBUSTIBLEADITIONAL
6-00000787PLAN 32017-07-06MAYBE COMBUSTIBLEADITIONAL
6-00000777PLAN 12017-07-06MAYBE COMBUSTIBLE 
6-00000822PLAN 12017-07-07COMBUSTIBLE 
6-00000812PLAN 12017-07-08MAYBE COMBUSTIBLEADITIONAL
6-00000813PLAN 22017-07-08MAYBE COMBUSTIBLEADITIONAL 
6-00000804PLAN 12017-07-08COMBUSTIBLE 
6-00000790PLAN 22017-07-08NO COMBUSTIBLEADITIONAL
6-00000780PLAN 12017-07-08MAYBE COMBUSTIBLEADITIONAL
6-00000815PLAN 12017-07-09NO COMBUSTIBLEADITIONAL
6-00000796PLAN 32017-07-09COMBUSTIBLEADITIONAL
6-00000786PLAN 12017-07-09MAYBE COMBUSTIBLEADITIONAL
6-00000781PLAN 12017-07-09MAYBE COMBUSTIBLE 
6-00000817PLAN 12017-07-10COMBUSTIBLEADITIONAL
6-00000806PLAN 32017-07-10MAYBE COMBUSTIBLEADITIONAL
6-00000793PLAN 32017-07-10NO COMBUSTIBLEADITIONAL
6-00000784PLAN 12017-07-10MAYBE COMBUSTIBLEADITIONAL
     

 

I need to get average of tickets created by date range, in this case, AVG of tickets created from 2017-07-06 to 2017-07-10 split by PLAN and with filter CATEGORY<> "COMBUSTIBLE" and TYPE="ADITIONAL", the expected table is:

 

PLANTOTALAVERAGE
PLAN 151
PLAN 220,4
PLAN 351

 

Thanks in advanceee!!! 🙂

1 ACCEPTED SOLUTION
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @JUSEGAPO

 

I created a new calculated table using the following code and got pretty close...

 

NEW TABLE  = 
GROUPBY(
        GROUPBY(
            ADDCOLUMNS(
                FILTER(
                    'Table2',
                    'Table2'[CATEGORY]<>"COMBUSTIBLE" 
                    && Table2[TYPE]="ADITIONAL"
                    ),
                "C",1),
            Table2[PLAN],
            Table2[DATE],
            "TOTAL",SUMX(CURRENTGROUP(),[C])            
            )
        ,[PLAN],
        "TOTAL",SUMX(CURRENTGROUP(),[TOTAL]),
        "AVERATE",AVERAGEX(CURRENTGROUP(),[TOTAL])
        )

I get different figures to you for both TOTAL and AVERAGE but that's because I was following your rules exactly.  In any case it should be easy to tweak.

 

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

1 REPLY 1
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @JUSEGAPO

 

I created a new calculated table using the following code and got pretty close...

 

NEW TABLE  = 
GROUPBY(
        GROUPBY(
            ADDCOLUMNS(
                FILTER(
                    'Table2',
                    'Table2'[CATEGORY]<>"COMBUSTIBLE" 
                    && Table2[TYPE]="ADITIONAL"
                    ),
                "C",1),
            Table2[PLAN],
            Table2[DATE],
            "TOTAL",SUMX(CURRENTGROUP(),[C])            
            )
        ,[PLAN],
        "TOTAL",SUMX(CURRENTGROUP(),[TOTAL]),
        "AVERATE",AVERAGEX(CURRENTGROUP(),[TOTAL])
        )

I get different figures to you for both TOTAL and AVERAGE but that's because I was following your rules exactly.  In any case it should be easy to tweak.

 

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors