cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
arifulice Regular Visitor
Regular Visitor

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

Accepted Solutions
pawel1 Member
Member

Re: calculate function

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

 

pawel1 Member
Member

Re: calculate function

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)

 

 

 

4 REPLIES 4
pawel1 Member
Member

Re: calculate function

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

 

arifulice Regular Visitor
Regular Visitor

Re: calculate function

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?

 

pawel1 Member
Member

Re: calculate function

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)

 

 

 

arifulice Regular Visitor
Regular Visitor

Re: calculate function

Hello Pawel1

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

Helpful resources

Announcements
Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Power BI Helps Homeless and Trouble Youth

Power BI Helps Homeless and Trouble Youth

We spoke with Power BI Super User, Greg Deckler, about his charity work

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Kudoed Authors
Users Online
Currently online: 379 members 3,703 guests
Please welcome our newest community members: