Hi, I have a problem with a simple metric. I would like the following metric to show me the sum that I am calculating in the given lines.
Code:
Share _% _ 1 = IF (CALCULATE (SUM (‘Date’ [Hours]))> 120,
DIVIDE (DISTINCTCOUNT (‘Date’ [Doc]), [count], 0), BLANK ())

Well to fix the totals you’ll just be required to write a small additional formula. One of our expert @Greg has already created a post onto the forum which specifically addresses this type of issue. Below is the link of that post provided for the reference purpose.

But when you write the formula you’ll see that how the context at the back-end is getting evaluated. On the visual you’re getting the results as “2.38%”. But at the back-end see how the results are getting evaulated by your formula. Below is the formula as well as the screenshot of the results provided for the reference -

If you see each distinctcount is getting divided by itself rather than the total. So actually to calculate the “Share_%_1” the formula should have been like this -

But now, when you write the formula to fix the totals see how the results are getting evaluated. Below is the formula to fix the totals as well as the screenshot of the final results provided for the reference -

So you’ll observe that although at the face of the visual our results are identical but at the back-end the context considered to evaluate the results is totally different.

I’m also attaching the working of the PBIX file for the reference.

Hoping you find this useful and meets your requirements that you’ve been looking for.