Forum Discussion
Total Column in Bar Chart for multiple years
Hi Community,
I created a bar chart with a total column.
The goal is, to have just one total column that shows the summarization of all selected years. The Selection is a slicer.
I have the following DAX formula:
Do you have any idea how to reach this goal?
Thank you
- Anonymous2 years ago
Hi bedata1 ,
You can update the formula of measure [Total_Sales_Chart] as below to get it:
Total_Sales_Chart = VAR _selmonth = SELECTEDVALUE ( Month_Name[Month_Name] ) VAR _selyear = SELECTEDVALUE ( 'Date'[Year] ) VAR total_ = CALCULATE ( [Total_Sales], REMOVEFILTERS ( Month_Name ), REMOVEFILTERS ( 'Date'[Year] ) ) VAR maxSelectedYear = CALCULATE ( MAX ( 'Date'[Year] ), ALL ( 'Date' ) ) RETURN IF ( _selmonth = "Total", IF ( _selyear = maxSelectedYear, total_, BLANK () ), [Total_Sales] )If the above ones can't help you figure out, please provide some raw data in your tables(exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:
How to provide sample data in the Power BI Forum
And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
1 Reply
- AnonymousNot applicable
Hi bedata1 ,
You can update the formula of measure [Total_Sales_Chart] as below to get it:
Total_Sales_Chart = VAR _selmonth = SELECTEDVALUE ( Month_Name[Month_Name] ) VAR _selyear = SELECTEDVALUE ( 'Date'[Year] ) VAR total_ = CALCULATE ( [Total_Sales], REMOVEFILTERS ( Month_Name ), REMOVEFILTERS ( 'Date'[Year] ) ) VAR maxSelectedYear = CALCULATE ( MAX ( 'Date'[Year] ), ALL ( 'Date' ) ) RETURN IF ( _selmonth = "Total", IF ( _selyear = maxSelectedYear, total_, BLANK () ), [Total_Sales] )If the above ones can't help you figure out, please provide some raw data in your tables(exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:
How to provide sample data in the Power BI Forum
And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards