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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Shreyash_Sanket
Regular Visitor

Show the Total volume in line and Bar Chart

Hi Everyone,

Table=
 
UNION(
    ADDCOLUMNS(
        GENERATESERIES(1, 12, 1),
        "MonthNumber", [Value],
        "MonthName", FORMAT(DATE(2000, [Value], 1), "MMMM"),
        "ShortMonthName", FORMAT(DATE(2000, [Value], 1), "MMM")
    ),
    ADDCOLUMNS(
        DATATABLE(
            "Value", INTEGER,
            {
                {13}
            }
        ),
        "MonthNumber", [Value],
        "MonthName", "Cumulative",
        "ShortMonthName", "**bleep**"
    )
)
This table I have joined with main table on monthnumber relation and values of this table Im using in x axis of bar chart.




Here Is one requirement where I want to show the total volume (bar ) in bar and line chart  along with all the month on the x axis.

So for that I created one table contains all the month names and one more dec as cumulative as shown in below

Shreyash_Sanket_0-1732023190565.png

Shreyash_Sanket_2-1732023537936.png

 

But when Im putting the measure it only shows the values for the available month data .I also want to show the Total volume at cumlulative .I tried many times but did not work.

Shreyash_Sanket_1-1732023455519.png

So at total  level I want to show the volume as shown in the above SS.
any pssoible way 
@amitchandak 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @Shreyash_Sanket 

You can use the following dax to achieve your need.

vyaningymsft_0-1732607010631.png

 

 

calculate % = 
VAR _value1 =
    SELECTEDVALUE ( 'Table (2)'[Value1] )
VAR _value2 =
    SELECTEDVALUE ( 'Table (2)'[Value2] )
VAR _monthName1 =
    SELECTEDVALUE ( 'Table'[MonthName] )
VAR _monthName2 =
    SELECTEDVALUE ( 'Table (2)'[Month] )
VAR _subCalculate =
    CALCULATE ( 1 - DIVIDE ( _value1, _value2 ) )
VAR _totalValue1 =
    SUMX ( ALL ( 'Table (2)' ), 'Table (2)'[Value1] )
VAR _totalValue2 =
    SUMX ( ALL ( 'Table (2)' ), 'Table (2)'[Value2] )
VAR _totalCalculate =
    CALCULATE ( 1 - DIVIDE ( _totalValue1, _totalValue2 ) )
RETURN
    IF (
        _monthName2 IN ALLSELECTED ( 'Table'[MonthName] ),
        _subCalculate,
        IF ( _monthName1 = "Cumulative", _totalCalculate )
    )


Best Regards,
Yang

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know.
Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

 



View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi, @Shreyash_Sanket 

You can use the following dax to achieve your need.

vyaningymsft_0-1732607010631.png

 

 

calculate % = 
VAR _value1 =
    SELECTEDVALUE ( 'Table (2)'[Value1] )
VAR _value2 =
    SELECTEDVALUE ( 'Table (2)'[Value2] )
VAR _monthName1 =
    SELECTEDVALUE ( 'Table'[MonthName] )
VAR _monthName2 =
    SELECTEDVALUE ( 'Table (2)'[Month] )
VAR _subCalculate =
    CALCULATE ( 1 - DIVIDE ( _value1, _value2 ) )
VAR _totalValue1 =
    SUMX ( ALL ( 'Table (2)' ), 'Table (2)'[Value1] )
VAR _totalValue2 =
    SUMX ( ALL ( 'Table (2)' ), 'Table (2)'[Value2] )
VAR _totalCalculate =
    CALCULATE ( 1 - DIVIDE ( _totalValue1, _totalValue2 ) )
RETURN
    IF (
        _monthName2 IN ALLSELECTED ( 'Table'[MonthName] ),
        _subCalculate,
        IF ( _monthName1 = "Cumulative", _totalCalculate )
    )


Best Regards,
Yang

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know.
Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

 



Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors