Forum Discussion
Anonymous
2 years agoNot applicable
Including a zero value period in Line chart calculated via Measure
Hi Guys, I've created a line Chart by using two measures: Blue line Green line The line chart result is as follows: How can I make sure the blue line which ha...
- 2 years ago
Your issue is that the count function returns null instead of 0 if there are no values. So, you need to modify your formula with an IF statement to allow it to return 0 when the count is 0. The formula is below.
CALCULATE1 = IF(CALCULATE(COUNT(Table2[Profit Center]),FILTER(Table2,Table2[Profit Center] = "P736064")) = 0, 0 ,CALCULATE(COUNT(Table2[Profit Center]),FILTER(Table2,Table2[Profit Center] = "P736064"))) - Anonymous2 years ago
Hi nsexton12,
Thank you very much for your help. I will try the advised formula for my learning process.
I literally just sorted the issue slightly differently:
NEW formula Blue line:
Stock PO's GR'd by Finance =VAR ForceZero = COUNTROWS('3 Source_KE5Z') > 0VAR Amt = calculate(count('3 Source_KE5Z'[Profit Center]),filter('3 Source_KE5Z','3 Source_KE5Z'[Profit Center]="P736064")) + If(ForceZero, 0)RETURN AmtresultKeep learning.
nsexton12
Resolver II
2 years agoYour issue is that the count function returns null instead of 0 if there are no values. So, you need to modify your formula with an IF statement to allow it to return 0 when the count is 0. The formula is below.
CALCULATE1 = IF(CALCULATE(COUNT(Table2[Profit Center]),FILTER(Table2,Table2[Profit Center] = "P736064")) = 0, 0 ,CALCULATE(COUNT(Table2[Profit Center]),FILTER(Table2,Table2[Profit Center] = "P736064")))