Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
Hey all!
I am trying to create a measure using the IF function.
The measure is supposed to calculate a sales provision based on a departments performance on hitrate, but on employee level.
So i got as far as getting the if function to work on a deparment level, but as soon as i put in the empoyees as rows instead of the departments, the measure starts to calculate the provision based on the employees hitrate. Is there a way to connect the employee to the department they belong, and based on that calculate the the provision.
What i want the measure to do is, to calculate as following:
if department A reaches hitrate X, the employee can get provision Y.
Is this even possible with Dax? i tried playing around with the use relation function but i dont know if that is the correct way to tackle this issue.
Solved! Go to Solution.
Yes it is possible, but DAX formulas always depend on the table and relationship structure. You haven’t provided any info about your setup, so it is not possible to give you an accurate answer.
In short, this has nothing to do with row context, it is filter context. When you put department into a table, the department filters the underlying data and gives you the result. When you add employee, a new filter context is added to employee preventing the department level calc working. It is a simple fix - just remove the filter from employee. Something like this.
CALCULATE([measure],ALL(table[employee]))
Hi,
Since you will have various combinations of departments, hit rates and provisions, it will be much better to table this data in a 3 column Table and then build relationships. We can then write measures to get your desired result.
Hi,
Since you will have various combinations of departments, hit rates and provisions, it will be much better to table this data in a 3 column Table and then build relationships. We can then write measures to get your desired result.
Yes it is possible, but DAX formulas always depend on the table and relationship structure. You haven’t provided any info about your setup, so it is not possible to give you an accurate answer.
In short, this has nothing to do with row context, it is filter context. When you put department into a table, the department filters the underlying data and gives you the result. When you add employee, a new filter context is added to employee preventing the department level calc working. It is a simple fix - just remove the filter from employee. Something like this.
CALCULATE([measure],ALL(table[employee]))
Thanks 🙂 i got it to work, i amde a combination of the 2 replys
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
124 | |
114 | |
74 | |
65 | |
46 |