The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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
Solved! Go to Solution.
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
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
User | Count |
---|---|
26 | |
10 | |
8 | |
6 | |
6 |
User | Count |
---|---|
31 | |
10 | |
10 | |
10 | |
9 |