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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

How to control the bar chart by changing select list

Hi everyone,

 

Am looking for a way to control the value of a categorial feature in the bar chart by changing select list.

 

Details are as follows.

There are two tables (A&B) which is attached below. In Table A, there is ITEM A and B. In Table B, there is ITEM C1 and C2.

The bar chart is categorized by ITEM.

The value of ITEM A from Table A is shown in bar A. Value of ITEM B from Table A is shown in bar B.

At for C1 and C2 of Table B, which one is going to be shown in the categorial feature ITEM C in the bar chart, should be selectable.

If C1 is chosen, the value of ITEM C1 in Table B, which is 300, will be shown in the bar chart as C.

If C2 is chosen, the value of ITEM C2 in Table B, which is 400, will be shown in the bar chart as C.

YuyangG_1-1723007927751.png

 

Anyone with good idea?

If any further infomation is needed please feel free to contact.

Thank you very much.

2 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

There are many ways of doing this but the safest will be to have a disconnected reference table with Items A,B,C  and then create a measure that cacluates the value for each item.

View solution in original post

Anonymous
Not applicable

Hi @Anonymous 

 

Has Ibendlin's response solved your problem? If so, please accept his reply as the solution.
If you still need more detailed steps, please refer below:
1. Create a table containing ITEM ABC and do not create relationships with other tables.

ITEMS = DATATABLE(
"ITEM", STRING,
{
{"A"},
{"B"},
{"C"}
}
)


2. Create a measure for each ITEM.

ITEM A VALUE =
IF(
MAX(ITEMS[ITEM]) = "A",
CALCULATE(SUM('Table A'[VALUE]), 'Table A'[ITEM] = "A"),
BLANK()
)
ITEM B VALUE =
IF(
MAX(ITEMS[ITEM]) = "B",
CALCULATE(SUM('Table A'[VALUE]), 'Table A'[ITEM] = "B"),
BLANK()
)
ITEM C VALUE =
IF(
MAX(ITEMS[ITEM]) = "C",
SWITCH(
TRUE(),
SELECTEDVALUE('Table B'[ITEM]) = "C1", CALCULATE(SUM('Table B'[VALUE]), 'Table B'[ITEM] = "C1"),
SELECTEDVALUE('Table B'[ITEM]) = "C2", CALCULATE(SUM('Table B'[VALUE]), 'Table B'[ITEM] = "C2"),
BLANK()
),
BLANK()
)


3. Creating a slicer using the ITEM field of TABLE B. In the bar chart, the ITEM of the ITEM table is used as the Y-axis, and the measures of the three ITEMs are used as the X-axis.

1.png

 

Best Regards,

Jarvis Tang

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

View solution in original post

3 REPLIES 3
lbendlin
Super User
Super User

There are many ways of doing this but the safest will be to have a disconnected reference table with Items A,B,C  and then create a measure that cacluates the value for each item.

Anonymous
Not applicable

Hi Ibendlin,

Thank you so much for your reply.

Will try this way.

 

Anonymous
Not applicable

Hi @Anonymous 

 

Has Ibendlin's response solved your problem? If so, please accept his reply as the solution.
If you still need more detailed steps, please refer below:
1. Create a table containing ITEM ABC and do not create relationships with other tables.

ITEMS = DATATABLE(
"ITEM", STRING,
{
{"A"},
{"B"},
{"C"}
}
)


2. Create a measure for each ITEM.

ITEM A VALUE =
IF(
MAX(ITEMS[ITEM]) = "A",
CALCULATE(SUM('Table A'[VALUE]), 'Table A'[ITEM] = "A"),
BLANK()
)
ITEM B VALUE =
IF(
MAX(ITEMS[ITEM]) = "B",
CALCULATE(SUM('Table A'[VALUE]), 'Table A'[ITEM] = "B"),
BLANK()
)
ITEM C VALUE =
IF(
MAX(ITEMS[ITEM]) = "C",
SWITCH(
TRUE(),
SELECTEDVALUE('Table B'[ITEM]) = "C1", CALCULATE(SUM('Table B'[VALUE]), 'Table B'[ITEM] = "C1"),
SELECTEDVALUE('Table B'[ITEM]) = "C2", CALCULATE(SUM('Table B'[VALUE]), 'Table B'[ITEM] = "C2"),
BLANK()
),
BLANK()
)


3. Creating a slicer using the ITEM field of TABLE B. In the bar chart, the ITEM of the ITEM table is used as the Y-axis, and the measures of the three ITEMs are used as the X-axis.

1.png

 

Best Regards,

Jarvis Tang

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

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.