Forum Discussion
wes-shen-poal
9 years agoHelper III
Dynamic Chart Based on Rank
Hi there, I'm wanting to create a column chart that will show me the count of vehicles for TopN Consignees + Other. It is the Other i don't know how to calculate. Other refers to all the Consigne...
- 9 years ago
Hi wes-shen-poal,
After reviewing your shared pbix file, I find that you may need to modify the following three measures, then it should work as expected. And I have sent you the modified pbix file in private message. :smileyhappy:
Count = VAR currentConsignee = FIRSTNONBLANK ( Consignee_List[Consignee], 1 ) RETURN CALCULATE ( DISTINCTCOUNT ( 'VMS Vehicle'[VehicleID] ), FILTER ( 'VMS Vehicle', 'VMS Vehicle'[Consignee] = currentConsignee ) )Rank = RANKX(ALL('Consignee_List'[Consignee]),[Count], ,DESC)Count for TopN Consignees = VAR othersCount = SUMX ( FILTER ( ALL ( Consignee_List ), [Rank] > [SelectedTopNNumber] ), [Count] ) RETURN IF ( HASONEVALUE ( Consignee_List[Consignee] ), SWITCH ( VALUES ( Consignee_List[Consignee] ), "Other", othersCount, IF ( [Rank] <= [SelectedTopNNumber], [Count] ) ) )Regards
wes-shen-poal
9 years agoHelper III
v-ljerr-msft
9 years agoMicrosoft Employee
Hi wes-shen-poal,
After reviewing your shared pbix file, I find that you may need to modify the following three measures, then it should work as expected. And I have sent you the modified pbix file in private message. :smileyhappy:
Count =
VAR currentConsignee =
FIRSTNONBLANK ( Consignee_List[Consignee], 1 )
RETURN
CALCULATE (
DISTINCTCOUNT ( 'VMS Vehicle'[VehicleID] ),
FILTER ( 'VMS Vehicle', 'VMS Vehicle'[Consignee] = currentConsignee )
)
Rank = RANKX(ALL('Consignee_List'[Consignee]),[Count], ,DESC)
Count for TopN Consignees =
VAR othersCount =
SUMX (
FILTER ( ALL ( Consignee_List ), [Rank] > [SelectedTopNNumber] ),
[Count]
)
RETURN
IF (
HASONEVALUE ( Consignee_List[Consignee] ),
SWITCH (
VALUES ( Consignee_List[Consignee] ),
"Other", othersCount,
IF ( [Rank] <= [SelectedTopNNumber], [Count] )
)
)
Regards