Huei
4 years agoFrequent Visitor
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
Sales Amt = CALCULATE(SUM(Sellout[Total Selling]),TREATAS(VALUES(Budget[Brand]),Sellout[BRAND]))+0
2) Calculated PY Sales Amount using measure
PY Sales Amt = CALCULATE([Sales Amt],SAMEPERIODLASTYEAR(Dates[Date].[Date]))
3) Status (if else) using measure
Status =
IF(
[Sales Amt]<> 0 && [PY Sales Amt] <> 0 && [Sales Amt]>[PY Sales Amt],
"Growing",
IF(
[Sales Amt]<>0 && [PY Sales Amt]<>0 && [Sales Amt]<[PY Sales Amt],
"Declining",
IF(
([Sales Amt])<>0 && [PY Sales Amt]=0 ,
"New",
IF(
[Sales Amt]=0 && [PY Sales Amt]<>0,
"Lost","-"
))))
Question
-----------
How can i calculate the 'Status'? i want to count How many status in Growing, Declining & New
Anyone can please advice?
Thanks
"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")