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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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