Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Team,
I have a matrix where i am trying to calculate cost per case. The formula for that would be - Total Product Cost / Total# of Cases. I created two measures. One to sum the total product cost and another to calculate distinct count of the cases and then created a third measure called cost per case utilizing the two measures for numerator and denominator.
Now, if you look at the Category D in the attached snapshot, it calculates the total product cost of each of the items in the drill down and takes the distinct number of cases where that item had been utilized - Which is correct but, is there any way i can have the denominator constant (Total # of cases by distinct names and by year since i might be adding a slicer for year in the future)?
For example, if i breakdown the 3164.91, i should be able to see the breakdown of what comprises to 3614.91 rather than an average. In other words, i want the product cost of each item divided by the total # of cases for each names.
Can someone assist me with this ?
Thanks in advance
The data structure looks like this
Solved! Go to Solution.
Hello @vmurali1 if you want the #cases to be constant by year, you can try to first create a new column year with formula
Year= YEAR(table[case date])
Then create a new measure
# cases by year = Calculate(distinctcount[column you want],allexcept(table,table[Year]))
If you want the # cases by year according to column "name" then just do
# cases by year = Calculate(count(table[name],allexcept(table,table[Year],table[name]))
Actually, i got the logic and it worked perfect. Thanks for the guidance.
Hello @vmurali1 if you want the #cases to be constant by year, you can try to first create a new column year with formula
Year= YEAR(table[case date])
Then create a new measure
# cases by year = Calculate(distinctcount[column you want],allexcept(table,table[Year]))
Thank you for the response but, i want the number of cases to be constant by name (first col) and year.
If you want the # cases by year according to column "name" then just do
# cases by year = Calculate(count(table[name],allexcept(table,table[Year],table[name]))
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
8 | |
8 | |
7 |
User | Count |
---|---|
14 | |
12 | |
11 | |
10 | |
8 |