cancel
Showing results for
Did you mean:
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
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

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
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

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?

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)

Regular Visitor

Re: calculate function

Hello Pawel1

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

Announcements

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

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

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Kudoed Authors
Users Online
Currently online: 379 members 3,703 guests
Recent signins: