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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Shashi_Kant82
Frequent Visitor

Dynamic calculation for bar and line chart with single slicer selection

Hi Guys,

 

I am creating a line and bar chart and my requirement is if i select "Sum" on a slicer, Bar should show the sum of products and line should show the sum of items. If i select "Count" on the slicer bar should show Count of products and Count of items on Line.

 

To simplyfy i want to make separate calculations for Bar and line with a single slicer selection.

 

Please help.

 

Regards,

Shashi

1 ACCEPTED SOLUTION
v-jialluo-msft
Community Support
Community Support

Hi @Shashi_Kant82 ,

 

Please follow these steps:

(1) Create a new measure

VALUE =
VAR _COUNT = COUNT('Table'[PROJECT])
VAR _TOTAL = SUM('Table'[SALES])
RETURN IF(VALUES(EX[SELECT])="COUNT",_COUNT,_TOTAL)

(2)Final output

vjialluomsft_0-1669777917438.png

 

vjialluomsft_1-1669777917439.png

 

Since there is no sample data, I made a simple example, if this does not help you, please provide sample data and the expected output.

 

Best Regards,

Gallen Luo

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

2 REPLIES 2
Shashi_Kant82
Frequent Visitor

Thank you @v-jialluo-msft 

v-jialluo-msft
Community Support
Community Support

Hi @Shashi_Kant82 ,

 

Please follow these steps:

(1) Create a new measure

VALUE =
VAR _COUNT = COUNT('Table'[PROJECT])
VAR _TOTAL = SUM('Table'[SALES])
RETURN IF(VALUES(EX[SELECT])="COUNT",_COUNT,_TOTAL)

(2)Final output

vjialluomsft_0-1669777917438.png

 

vjialluomsft_1-1669777917439.png

 

Since there is no sample data, I made a simple example, if this does not help you, please provide sample data and the expected output.

 

Best Regards,

Gallen Luo

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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