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
Power_BI_Adapt
Resolver I
Resolver I

How to sum the values of a measure in DAX?

Dear All,

 

I do have a simple matrix in Power BI, where the values are taken from a measure. See below screenshot:

Power_BI_Adapt_0-1658305089147.png

 

I want to create the column 'Total' with a DAX function as measure, too. 

 

Question: how can I create a new measure which is a sum of the values in the measure number of orders shipped? (ranging from Jan  to June in this example). Since this isn't column name / field, I cannot use for example the formula:

 

CALCULATE(SUM(table[number of orders shipped], ALL(table))

 

Any suggestion is welcome

 

Kind regards,

 

1 ACCEPTED SOLUTION
v-chenwuz-msft
Community Support
Community Support

Hi @Power_BI_Adapt ,

 

You need to create virtual table via SUMMARIZE() in measure to do that.

 

Total =
VAR _s =
    SUMMARIZE (
        'Table',
        [customer number],
        [customer name],
        date[month],
        "v_Number of orders shipped", [number of orders shipped]
    )
RETURN
    SUMX ( _s, [v_Number of orders shipped] )

 

Result:

vchenwuzmsft_0-1658740341918.png

 

If i missunderstood you, please let me know.

 

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-chenwuz-msft
Community Support
Community Support

Hi @Power_BI_Adapt ,

 

You need to create virtual table via SUMMARIZE() in measure to do that.

 

Total =
VAR _s =
    SUMMARIZE (
        'Table',
        [customer number],
        [customer name],
        date[month],
        "v_Number of orders shipped", [number of orders shipped]
    )
RETURN
    SUMX ( _s, [v_Number of orders shipped] )

 

Result:

vchenwuzmsft_0-1658740341918.png

 

If i missunderstood you, please let me know.

 

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Avantika-Thakur
Solution Supplier
Solution Supplier

Hi @Power_BI_Adapt ,

You can try using CALCULATE( SUMX(Table,[number of orders shipped]), ALLEXCEPT(table,table'customer number'))

Thanks for this suggestion, but I am still struggling with the fact that Number of orders shipped  is not a field name in table, but just a measure. The SUM or SUMX function does not work.

Avantika-Thakur
Solution Supplier
Solution Supplier

Hi @Power_BI_Adapt ,

Assuming that you need the total of Number of orders shipped for each customer , you can try using below formula -

CALCULATE(SUM(table[number of orders shipped], ALLEXCEPT(table,table'customer number'))

 

Please accept the solution if this answers your query.

Thanks!

Avantika

Thanks for your feedback and correctly understood regarding the number of orders shipped by customer number is required.

 

There is a challenge on the field Number of order shipped. It's not a field name in a table. It's a measure and there I cannot execute the first part of the formula (CALCULATE(SUM(table[number of orders shipped].......)

 

I am seeking for an alternative.

 

Thanks for any additional suggestion.

 

Kind regards,

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.

Top Solution Authors