Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

comparing values based on slicers

Hi,

I want to display a company's ranking count and it's competitors count for different products and subproducts in 100% stacked bar chart. When a user pass a particular company name through parameter, the ranking count for this company and it's competitors should be calculated based on the values selected in multiple slicers by the user. The competitors nos. should not include the selected company and use rank in the legend. 

I have two challenges to achieve this:

1. How to calculate ranking count for company and competitors based on the values selected in the slicers

2. How to display them on a single visual (100% stacked bar chart)

 

In the below screenshot, the visual in the lower section is ideal to display the information but it is comingup with a paid license not a free visual:

mypowerbi1_1-1640184449680.png

 

Thanks

 

7 REPLIES 7
v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

Sorry I can't reproduce your sample, could you please provide more details about your sample? Companies are in the column Company Name, what chout competitors, are they in the same table in another column? Then how to  distinguish the value of company and competitor.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi @v-yanjiang-msft ,

 

Yes, companies  are in column Company Name and competitors are also in the same column. The Company Name will be provided through a parameter and competitors will be considered based on the selected values in the slicers within filter criteria and will not include the company against which we are going to compare.

Also, this report will be embedded within a sharpoint site and Client name parameter will be passed at there only.

 

the below is the sample data:

CompanyRankProductSub ProductsCountryPriceNo. of Customers

ABadPhoneBatteryIndia30000250000
BGoodTVHeadphoneUS500050000
CExcellentTVSpeakerGermany60000134000
DGoodTVSpeakerGermany70000300000
AExcellentPhoneBatteryIndia1200020000
BBadTVSpeakerIndia3000090000
CGoodPhonePhone CoverUS3000120000
DExcellentPhonePhone CoverGermany90000230000
AGoodTVHeadphoneGermany5000034000
BBadPhonePhone CoverIndia80000250000
CGoodTVHeadphoneUS700070000
DExcellentPhonePhone CoverGermany13000170000
CExcellentTVSpeakerGermany60000134000
DGoodTVSpeakerGermany70000300000
AExcellentPhoneBatteryIndia1200020000
BBadTVSpeakerIndia3000090000
CGoodPhonePhone CoverUS3000120000
AExcellentPhoneBatteryIndia1200020000
BBadTVSpeakerIndia3000090000
CGoodPhonePhone CoverUS3000120000
DExcellentPhonePhone CoverGermany90000230000
AGoodTVHeadphoneGermany5000034000
BBadPhonePhone CoverIndia80000250000
CGoodTVHeadphoneUS700070000
DExcellentPhonePhone CoverGermany13000170000
CExcellentTVSpeakerGermany60000134000
BBadTVSpeakerIndia3000090000
CGoodPhonePhone CoverUS3000120000
AExcellentPhoneBatteryIndia1200020000
BBadTVSpeakerIndia3000090000
CGoodPhonePhone CoverUS3000120000
DExcellentPhonePhone CoverGermany90000230000
AGoodTVHeadphoneGermany5000034000
BBadPhonePhone CoverIndia80000250000
CGoodTVHeadphoneUS700070000
DExcellentPhonePhone CoverGermany13000170000
CExcellentTVSpeakerGermany60000134000
DGoodTVSpeakerGermany70000300000
AExcellentPhoneBatteryIndia1200020000
BBadTVSpeakerIndia3000090000
CGoodPhonePhone CoverUS3000120000
AExcellentPhoneBatteryIndia1200020000
BBadTVSpeakerIndia3000090000
CGoodPhonePhone CoverUS3000120000
DExcellentPhonePhone CoverGermany90000230000
AGoodTVHeadphoneGermany5000034000
BBadPhonePhone CoverIndia80000250000
CGoodTVHeadphoneUS700070000
DExcellentPhonePhone CoverGermany13000170000
CExcellentTVSpeakerGermany60000134000

 

Thanks

Hi @Anonymous ,

According to your description, here's my solution.

1.Create a new table.

vkalyjmsft_0-1640658752201.png

Table 2 = VALUES('Table'[Company])

There's no relationship of the two tables.

vkalyjmsft_1-1640658836730.png

2.Create a measure.

Check = IF(SELECTEDVALUE('Table 2'[Company])=MAX('Table'[Company]),1,0)

3.For the company visual, put Product and Company in Axis, Rank in legend and values, put the measure in the visual filter and set its value is 1.

vkalyjmsft_2-1640659019656.png

The same for the competitor visual, but set the measure is 0.

vkalyjmsft_3-1640659227178.png

 

 4.Put the company column in the new table into a slicer, then get the expected result.

vkalyjmsft_4-1640659308985.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

Thanks @v-yanjiang-msft  for the soultion above. 

Actually i had mentioned about 2 challlanges above in the question and it solves the 1st one. My 2nd challenge is still remaining as how to dispaly them (Client and Peer's values) within a single visual - 100% stacked bar chart.

Addititonaly, although it is not a part of my initial question, how to calculate the measures if selected value is coming through a parameter in embeded report in sharepoint portal rather than slicer.

Aprreciate for the help.

Thanks

 

Hi @Anonymous ,

By my test, I don't think you can dispaly them (Client and Peer's values) within a single visual, as the filter of them(Client and Peer's values) are different. I tried to create a competitor measure, but multiple values cann't be calculate by a measure.

About using the parameter in other report, as long as it has no relationship with the above sample data table, you can modify the formula according to your situation.

Check= IF(SELECTEDVALUE('Table3'[Parameter])=MAX('Table'[Company]),1,0)

If your model is more complex, could you please upload your pbix file without sensitive information for reference.

Best Regards,
Community Support Team _ kalyj

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi @v-yanjiang-msft ,

 

Here is a the sample data. 

Also, I found one custom visual multi axes chart by xViz. this visual is helping me to present client and competitors values on single visual along with legend. Please recommend for this visual also if i can go with it as it seems paid one.

I am using these measure for client and compeitors values:

 

Client Grade =
var parameter = SELECTEDVALUE(clientvscompsample[Client Name],BLANK())
var ClientGrade = CALCULATE(COUNT(clientvscompsample[Grade])
,clientvscompsample[Client Name]= parameter)
Return
ClientGrade
 
Competitors Grade =
var parameter = SELECTEDVALUE(clientvscompsample[Client Name],BLANK())
var CompGrade = CALCULATE(COUNT(clientvscompsample[Grade])
,clientvscompsample[Client Name]= parameter)
Return
CompGrade

 

Client NameSurvey AreaTaskSub TaskGrade
ABCOperationsMaintenanceClosingTop 
ABCOperationsMaintenanceOpeningTop 
ABCHRPayrollOversightTop 
ABCHRPayrollProcessingTop 
BEFTFDFinancialDraftsHigh
BEFTFDFinancialDraftsLow
XYZ   High
XYZsecurityTsecurityPTsecurityOrdinary
XYZHRPayrollSystem AccessHigh
PSTsecurityTsecurityPTsecurityAbuse
PQRHRPayrollPA ReportingHigh
PQRHRPayrollOversightHigh
PQRHRPayrollProcessingHigh
RSTBankingACHSet-upHigh
RSTBankingACHProcessingHigh
RSTBankingSelfAuditHigh
PVTFinancialInstitutionRemediationHigh
RMSAccountingReportingMonitoringAbuse
SPSAccountingAccountingAccounts PayableHigh

Hi @Anonymous ,

By your formula, it always gets the same count value of Client Grade and Competitors Grade.

vkalyjmsft_0-1640685958602.png

I can import the Multiple Axes Chart-XViz visual successfully, just click Get more visuals and enter the visual name then click Add. 

vkalyjmsft_4-1640686255734.png

 

vkalyjmsft_2-1640686120811.png

vkalyjmsft_3-1640686130235.png

If you cann't import it , is your Power BI account free license? Try to upgrade it to Pro trial and reimport again.

Best Regards,
Community Support Team _ kalyj

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors