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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Anonymous
Not applicable

Total Sum last Bar Chart

Hi Team,

 

DAX -->

I have monthwise Bar chart in that need to add last Bar for Total sum.

 

 

 

logo.JPG

 

Thanks,

Kv

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I suggest having an additional axis table like below.

I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

All measures are in the attached pbix file.

I hope the below DAXs for creating an axis table and a measure provide ideas in order to create the solution for your data model.

Slide1.jpg

 

 

Axis table month = 
UNION (
    SUMMARIZE ( 'Calendar', 'Calendar'[Month & Year], 'Calendar'[End of Month] ),
    ROW (
        "columnA", "Total",
        "columnB", MAXX ( 'Calendar', 'Calendar'[End of Month] + 1 )
    )
)

 

 

 

Value total measure: = 
SWITCH (
    SELECTEDVALUE ( 'Axis table month'[Month & Year] ),
    "Total", SUM ( Data[Value] ),
    CALCULATE (
        SUM ( Data[Value] ),
        TREATAS (
            VALUES ( 'Axis table month'[Month & Year] ),
            'Calendar'[Month & Year]
        )
    )
)

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or accept the helpful suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Arul
Super User
Super User

@Anonymous ,

you can also try to create a table with the below code and use it in bar chart,

New Bar Table = 
VAR _total= SUMMARIZECOLUMNS('Table'[Month],"1",SUM('Table'[Value]))
VAR _columns= SELECTCOLUMNS(_total,"Month","Total","Value",[1])
return
UNION('Table',_columns)

Arul_0-1652283987724.png

Thanks,

Arul

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


Jihwan_Kim
Super User
Super User

Hi,

I suggest having an additional axis table like below.

I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

All measures are in the attached pbix file.

I hope the below DAXs for creating an axis table and a measure provide ideas in order to create the solution for your data model.

Slide1.jpg

 

 

Axis table month = 
UNION (
    SUMMARIZE ( 'Calendar', 'Calendar'[Month & Year], 'Calendar'[End of Month] ),
    ROW (
        "columnA", "Total",
        "columnB", MAXX ( 'Calendar', 'Calendar'[End of Month] + 1 )
    )
)

 

 

 

Value total measure: = 
SWITCH (
    SELECTEDVALUE ( 'Axis table month'[Month & Year] ),
    "Total", SUM ( Data[Value] ),
    CALCULATE (
        SUM ( Data[Value] ),
        TREATAS (
            VALUES ( 'Axis table month'[Month & Year] ),
            'Calendar'[Month & Year]
        )
    )
)

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.