cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Udt_KV
Post Partisan
Post Partisan

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 @Udt_KV,

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

@Udt_KV ,

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

 

If I answered your question then mark my post as a solution and a kudo would be appreciated.
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
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.