Forum Discussion
Count Measure Values
Hi Guys,
I need help,
Below are my current result
| CustomerName | Status | SalesAmount | PY SalesAmount |
| Customer 1 | Growing | 167,088 | 49,588 |
| Customer 2 | New | 34,470 | 0.00 |
| Customer 3 | New | 5,400 | 0.00 |
| Customer 4 | Growing | 11,191 | 436.62 |
| Customer 5 | Declining | 1,164 | 27,775 |
1 ) Calculated Sales Amount using measure
"i change to use calculated column"
Why? I thought your goal was to do everything with measures?
Here is the formula for the calculated column version:
Column Group = SWITCH(TRUE(), ISBLANK([PY SalesAmount]) && ISBLANK([SalesAmount]),"Inactive", ISBLANK([PY SalesAmount]) && not ISBLANK([SalesAmount]),"New", not ISBLANK([PY SalesAmount]) && ISBLANK([SalesAmount]),"Lost", [SalesAmount]>[PY SalesAmount],"Increasing", [SalesAmount]<[PY SalesAmount],"Declining", "Same")
11 Replies
- lbendlinSuper User
Just to confirm - you want this all as measures? (it would be easier as calculated columns).
You are also missing the scenario when the two values match.
- HueiFrequent Visitor
Hi Ibendlin,
I'm New in Power BI. If use calculated columns meaning all measures change to calculated columns for Sales amount, PY Sales amount and status?
Thanks
- lbendlinSuper User
Calculated columns are only computed once during dataset refresh. Measures are recomputed each time the user interacts with the report. More flexibiliy, at the expense of more compute.
- HueiFrequent Visitor
I had tried to use calculated columns for all the measure, but the result was wrong that's why i use all measure. Can i count the measure?
- HueiFrequent Visitor
Hi Ibendlin,
It's worked, thankyou so much! Appreciate.
- lbendlinSuper User
Glad to hear. Just to reiterate - you cannot count measure values. You need to formulate the business requirement and then write another measure that implements the associated logic.
Also note that my first measure is not fully covering all scenarios. (for example when both current and previous year values are blank). Adjust as needed.
- HueiFrequent Visitor
Okay, noted. I will check first measure. But i still having problem here, i change to use calculated column for TY sales amount and PY sales amount, but the PY Sales amount show blank. Can you please advise?
Thanks.