Forum Discussion
Use Column from ADDCOLUMNS in CALCULATE filtercontext
Rank 7 Service =
VAR _Services =
VALUES ( 'Ergebnisse DAK & IKK'[Service] )
VAR _RankingTable =
ADDCOLUMNS ( _Services, "Rank", RANKX ( _Services, [Anzahl Antworten], ,DESC ) )
RETURN
CALCULATE ( _RankingTable, _RankingTable[Rank] = 7 )
Hej grazitti_sapna,
unfortunately it doesn't work.
In the Screenshot you'll see, that the VAR _ServiceAtRank7 = doesn't recognize the _RankingTable[Rank] from the VAR _RankingTable.
But I've found a solution myself.
Service #7 DisplayValue =VAR _Nth = 7VAR _ReferenceService = ALLSELECTED('Ergebnisse DAK & IKK'[Service])VAR _ServiceAndTickets =ADDCOLUMNS(VALUES( 'Ergebnisse DAK & IKK'[Service] ),"Rank", RANKX( _ReferenceService, [Anzahl Antworten]))VAR _FilterNthProduct =FILTER( _ServiceAndTickets, [Rank] = _Nth )RETURNCALCULATE([DisplayValue],FILTER('Ergebnisse DAK & IKK','Ergebnisse DAK & IKK'[Service] = _NthService))This works very fine and the main difference is only, that the filter function is stored in a different VAR. This is the clue behind.But thanks for your fast reply! 🙂
2 Replies
- grazitti_sapna
Super User
Hi Chiniminiz ,
Please try using:-Rank 7 Service =
VAR _Services =
VALUES ( 'Ergebnisse DAK & IKK'[Service] )
VAR _RankingTable =
ADDCOLUMNS ( _Services, "Rank", RANKX ( _Services, [Anzahl Antworten], ,DESC ) )
VAR _ServiceAtRank7 =
CALCULATETABLE (
_RankingTable,
FILTER ( _RankingTable, _RankingTable[Rank] = 7 )
)VAR _Service7Values =
CALCULATE (
VALUES ( 'Ergebnisse DAK & IKK'[Value] ),
'Ergebnisse DAK & IKK'[Service] IN SELECTCOLUMNS ( _ServiceAtRank7, "Service", 'Ergebnisse DAK & IKK'[Service] )
)RETURN
_Service7ValuesAnd please let me know if it works.
Thank you
- ChiniminizFrequent Visitor
Hej grazitti_sapna,
unfortunately it doesn't work.
In the Screenshot you'll see, that the VAR _ServiceAtRank7 = doesn't recognize the _RankingTable[Rank] from the VAR _RankingTable.
But I've found a solution myself.
Service #7 DisplayValue =VAR _Nth = 7VAR _ReferenceService = ALLSELECTED('Ergebnisse DAK & IKK'[Service])VAR _ServiceAndTickets =ADDCOLUMNS(VALUES( 'Ergebnisse DAK & IKK'[Service] ),"Rank", RANKX( _ReferenceService, [Anzahl Antworten]))VAR _FilterNthProduct =FILTER( _ServiceAndTickets, [Rank] = _Nth )RETURNCALCULATE([DisplayValue],FILTER('Ergebnisse DAK & IKK','Ergebnisse DAK & IKK'[Service] = _NthService))This works very fine and the main difference is only, that the filter function is stored in a different VAR. This is the clue behind.But thanks for your fast reply! 🙂