Forum Discussion
How to control the bar chart by changing select list
- 2 years ago
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.
- Anonymous2 years ago
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.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.
Hi Ibendlin,
Thank you so much for your reply.
Will try this way.
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.
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.