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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

How to create a measure which ignores the page filter but considers all other filters?

Hi,

I have two example tableas as below

 

Combined

LocationMONTHYEARSeaterDateTotal SpendUniqueID
AJAN20204S01-Jan-2020220124S-A-January-2020
BFEB20204S01-Jan-2017343484S-B-January-2020
CMAR20204S01-Jan-2019744974S-C-January-2020
AJAN20206S01-Jan-2018406996S-A-January-2020

 

Last_3M_data

LocationDateSeaterUsersUniqueIDTeam
A01-Jan-204SA0014S-A-January-2020Alpha
A02-Jan-204SA0014S-A-January-2020Alpha
B01-Jan-204SA0024S-B-January-2020Bravo
C01-Jan-204SA0034S-C-January-2020Delta
A03-Jan-206SA0016S-A-January-2020Alpha

 

Both the tables are linked together with the UniqueID

 

I am trying to create a measure which gives me an "average cost per user" irrespective of team

 

Ideally its calculated as below

Total Spend/ No of users(not unique) 

 

Once I have that number I would like to multiply the "average cost per user" * number of users in a team to get the amount spent by the team from the Total spend.

 

That being said I've to create different sheets for different teams ideally I put the team under filter and select a team and calculate the below measures

 

1.   Need to get the total number of users irrespective of which team they are part of

Total no of users = CALCULATE(COUNTA(Last_3M_data[Users]), ALL(Last_3M_data[Team]))
Above gives me the number of user per month which is great, it also ignonres the selected team from page filter.
 
2. In this filter I want the average cost to be constant for each month but its not I think I'm not doing someting right. Ideally I dont want the average cost to change when I select different team because I want to multiply the average cost with the no of users in that team to find the amount spent by that team.
Avg_Cost_per-user = CALCULATE(DIVIDE(SUM(Combined[Total Spend]), [Total no of users]), ALL(Last_3M_data[Team]))
 

 

3. 

Total_Spend_per_team = CALCULATE(COUNT(Last_3M_data[Emp Id])*[Avg_Cost_per-emp_ per-trip])
This measure works but is not giving the correct numbers as and when the team change I believe its because the above measures are not set properly.
 
Please advise how this can be fixed 
 
Thank you

 

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , Make sure you create common dimensions and join them with both tables

 

This can be done on one the common dimension that is base of this calculation

sumx(summarize(location,location[Location],"_1",CALCULATE(COUNT(Last_3M_data[Emp Id]),"_2",[Avg_Cost_per-emp_ per-trip])),[_1]*[_2])

Anonymous
Not applicable

@amitchandak 

 

Thank you for responding. But I dont understand your solution, Please pardon me am very new to Power BI and DAX.

If you are referring to linked columns then UniqueID is the one from those two tables which are linked with each other in Models.

 

Could you please explain how exactly the solution you've given would work.

 

Thank

 

Hi @Anonymous,

 

Could you share the sample pbix via cloud service like onedrive for business?So that can help us know your scenario more clear.

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.