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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Syndicate_Admin
Administrator
Administrator

Sum and average with multiple filters

Hello everyone.

I have a table with data of procedures carried out, such as the following:

Codigo_ObraThroughEstado_AprobTotal TermMeets deadline
260915401APPROVED42Defeated
227315402IN PROCESS20OK
227215403APPROVED79Defeated
200815404APPROVED79Defeated
232715405APPROVED127Defeated
258215406IN PROCESS146Defeated
244515407APPROVED28OK
232715408APPROVED38Defeated
232715409IN PROCESS40Defeated

I need to post the following procedures:

  • approved and expired
  • approved and ok
  • in process and expired
  • in process and ok

For which I use for example the following formula:

Tramites_AprobOK = COUNTROWS(FILTER(Data,and(Data[Estado_Aprob]="APPROVED",Data[Meets deadline]="ok")))
Tramites_EnTramiteOK = COUNTROWS(FILTER(Data,and(Data[Estado_Aprob]="In Process",Data[Meets deadline]="OK")))
The above formula is ok??
The same I need to calculate the average number of days it takes to approve a procedure with 2 condciones
  • approved and expired
  • approved and ok
  • in process and expired
  • in process and ok
Since I could not filter with 2 conditions and calculate the pomedium, use the following formulas:
Dias_Prom_Aprob = CALCULATE(AVERAGE(Data[Total Term]),Data[Estado_Aprob]="APPROVED")
Dias_AprobOK = AVERAGEX(FILTER(Data,Data[Meets Deadline]="ok") ,Data[Dias_Prom_Aprob])
How do I calculate the average with a single formula?? Or is it ok like that??
Thanks a lot
1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Syndicate_Admin 

 

Try something like below for average with multiple conditions.

Dias_AprobOK =
CALCULATE (
    AVERAGE ( Data[Total Term] ),
    Data[Estado_Aprob] = "APPROVED",
    Data[Meets deadline] = "OK"
)

Or

Dias_AprobOK =
AVERAGEX (
    FILTER ( Data, Data[Estado_Aprob] = "APPROVED" && Data[Meets Deadline] = "ok" ),
    Data[Total Term]
)

 

If you want a blank value to appear like a zero, you can add +0 at the end of your formula. Something like

Dias_AprobOK =
AVERAGEX (
    FILTER ( Data, Data[Estado_Aprob] = "APPROVED" && Data[Meets Deadline] = "ok" ),
    Data[Total Term]
) + 0 

 

You can use && to connect multiple filtering conditions. See DAX syntax.

 

Let me know if you have any questions.

 

Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.

View solution in original post

3 REPLIES 3
v-jingzhang
Community Support
Community Support

Hi @Syndicate_Admin 

 

Try something like below for average with multiple conditions.

Dias_AprobOK =
CALCULATE (
    AVERAGE ( Data[Total Term] ),
    Data[Estado_Aprob] = "APPROVED",
    Data[Meets deadline] = "OK"
)

Or

Dias_AprobOK =
AVERAGEX (
    FILTER ( Data, Data[Estado_Aprob] = "APPROVED" && Data[Meets Deadline] = "ok" ),
    Data[Total Term]
)

 

If you want a blank value to appear like a zero, you can add +0 at the end of your formula. Something like

Dias_AprobOK =
AVERAGEX (
    FILTER ( Data, Data[Estado_Aprob] = "APPROVED" && Data[Meets Deadline] = "ok" ),
    Data[Total Term]
) + 0 

 

You can use && to connect multiple filtering conditions. See DAX syntax.

 

Let me know if you have any questions.

 

Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.

Sorry for the delay in responding, I was solving other issues.

Thank you very much for the solution, I was able to try the 3 formulas and they work perfectly.

Thanks again

Shortly I will write new doubts

Syndicate_Admin
Administrator
Administrator

I add to the above that also when I have no data the word white appears and I would like it to look like a zero

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.