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
arifulice
Helper I
Helper I

calculate function

The following expression give the Total salary of all month or only May ? Please help me.....

 

 CALCULATE([TotalSalary],FILTER(ALL(FactSalary[Month]), FactSalary[Month]="May"))

2 ACCEPTED SOLUTIONS
pawel1
Kudo Kingpin
Kudo Kingpin

May only

 

  • CALCULATE([TotalSalary],FILTER(ALL(FactSalary[Month]), FactSalary[Month]="May"))      filters to MAY of selected year
  • CALCULATE([TotalSalary],FILTER(ALL(FactSalary),              FactSalary[Month]="May"))      filters to all MAYs,  regardless of selected year

 

View solution in original post

Hello arifulice

I'm not an expert on DAX but I found a good explanation here:

https://community.powerbi.com/t5/Desktop/Filter-and-Allexcept/td-p/76403

 

the way I understand:

 

CALCULATE([TotalSalary],FILTER(ALL(FactSalary[Month]), FactSalary[Month]="May"))

the filter iterates only the values of the [Month] column (you will see May only).  It is the same as:

CALCULATE([TotalSalary],FactSalary[Month]="May"))

 

in order to remove all the filters from other columns, you change to:

CALCULATE([TotalSalary],FILTER(ALL(FactSalary), FactSalary[Month]="May"))

where the only difference is that the filter iterates the entire FactSalary table and not only the values of the Month column  (you see all months)

 

 

 

View solution in original post

4 REPLIES 4
pawel1
Kudo Kingpin
Kudo Kingpin

May only

 

  • CALCULATE([TotalSalary],FILTER(ALL(FactSalary[Month]), FactSalary[Month]="May"))      filters to MAY of selected year
  • CALCULATE([TotalSalary],FILTER(ALL(FactSalary),              FactSalary[Month]="May"))      filters to all MAYs,  regardless of selected year

 

Hello, pawel1

Although I have understand the problem but further you  briefly  describe the solution .(Why only  May will be the answer Although the ALL(FactSalary[Month])  remaining?

 

Hello arifulice

I'm not an expert on DAX but I found a good explanation here:

https://community.powerbi.com/t5/Desktop/Filter-and-Allexcept/td-p/76403

 

the way I understand:

 

CALCULATE([TotalSalary],FILTER(ALL(FactSalary[Month]), FactSalary[Month]="May"))

the filter iterates only the values of the [Month] column (you will see May only).  It is the same as:

CALCULATE([TotalSalary],FactSalary[Month]="May"))

 

in order to remove all the filters from other columns, you change to:

CALCULATE([TotalSalary],FILTER(ALL(FactSalary), FactSalary[Month]="May"))

where the only difference is that the filter iterates the entire FactSalary table and not only the values of the Month column  (you see all months)

 

 

 

Hello Pawel1

Thank you so  much. I have understand the solution, Thats you described in your post...

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