Forum Discussion
Kishorb
7 years agoFrequent Visitor
DAX
HI , I need a help in correcting measure defination which was display 'second lowest value' into a table but when i used this measure into Card visual then blank() value displayed. I have created...
- 7 years ago
Use calculate column instead of measure to achieve the rank:
MRank2 = RANKX ( FILTER ( 'Sales Data', 'Sales Data'[Dep] = EARLIER('Sales Data'[Dep]) ), RANKX ( ALL ( 'Sales Data' ), 'Sales Data'[Target],, DESC, Dense) )Then modify the measure like below:
Second lowest Quota = VAR lowest_count = COUNTROWS(FILTER('Sales Data', 'Sales Data'[MRank2] = 1)) RETURN CALCULATE(MAX('Sales Data'[Target]), FILTER(ALL('Sales Data'), 'Sales Data'[MRank2] = lowest_count + 1))Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Kishorb
7 years agoFrequent Visitor
I have shared below sample data table for reference
| SalesManager | SalesRep | Dep | Target |
| Peter | Andrew | Prop1 | 210000 |
| Peter | Macman | Prop1 | 280000 |
| Peter | Alex | Prop1 | 210000 |
| Peter | Jack | Prop1 | 78000 |
| Peter | Joe | Prop1 | 120000 |
| Peter | peter | Prop1 | 120000 |
| Peter | Adam | Prop1 | 120000 |
| Peter | Stephanie | Prop1 | 210000 |
| Peter | Kirsten | Prop1 | 350000 |
| Lenda | Ajay | Pro2 | 5000000 |
| Lenda | Rocky | Pro2 | 3000000 |
| Lenda | Pratik | Pro2 | 3500000 |
| Lenda | Harshal | Pro2 | 1000000 |
| Lenda | Das | Pro2 | 2500000 |
| Lenda | Vivek | Pro2 | 1700000 |
| Lenda | Lina | Pro2 | 1500000 |
| Lenda | Dhoni | Pro2 | 1000000 |
v-yuta-msft
7 years agoCommunity Support
Use calculate column instead of measure to achieve the rank:
MRank2 =
RANKX (
FILTER (
'Sales Data', 'Sales Data'[Dep] = EARLIER('Sales Data'[Dep])
),
RANKX ( ALL ( 'Sales Data' ), 'Sales Data'[Target],, DESC, Dense)
)
Then modify the measure like below:
Second lowest Quota =
VAR lowest_count = COUNTROWS(FILTER('Sales Data', 'Sales Data'[MRank2] = 1))
RETURN
CALCULATE(MAX('Sales Data'[Target]), FILTER(ALL('Sales Data'), 'Sales Data'[MRank2] = lowest_count + 1))
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Kishorb7 years agoFrequent Visitor
Thanks it's working for me
- v-yuta-msft7 years agoCommunity Support
Great to hear that. Could you please help mark the correct answer to finish the thread? Your contribution will be much appreciated.
Regards,
Jimmy Tao