Forum Discussion
How to GroupyBy to keep filtered values
woolf COUNTA( 'Table'[ProductId] ) See PBIX attached below signature.
Thanx for the quick answer! For showing the numbers it's works perfect. But how can I implement an additional criteria. "Based on the current active filters show me stocks smaller 1 (Order now) and greater 2 (No further action)."
I've two measures now. Count_1 = COUNTA( 'Table'[ProductId] ) and a second one Count_2 = IF([Count_1]=1,"Order now","No further action")
Why I need it based on the filters? If I've 4 pieces in Spain, I can check the different shops and I've to identify is there a Shop with more then 2 pieces and I can shift it from to another.
That was the reason why I tried it with new table but the filtered values were not available.
StockCompare=ADDCOLUMNS(GROUPBY('ImportedTable','ImportedTable'[ProductID],"Cnt.",COUNTAX(CURRENTGROUP(),'ImportedTable'[ProductID])),"Stock",IF([Cnt.]=1,"Order now","No further action"))
| ProductId | Count_1 | Count_2 |
| 1574498 | 2 | No further action |
| 1574536 | 1 | Order now |
| 1574641 | 1 | Order now |
| 1574659 | 2 | No further action |
| 1574669 | 1 | Order now |
| 1575612 | 1 | Order now |
| 1575679 | 2 | No further action |
| 1575693 | 1 | Order now |
- Anonymous2 years agoNot applicable
Hi woolf ,
You can do this by simply using an if statement:
Measure 2 = IF([Measure]=1,"order now","No further action")Hope it helps!
Best regards,
Community Support Team_ Scott ChangIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.