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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
afbraga66
Helper III
Helper III

Total/Subtotal value sum of lines measure result

Hi,

 

I'm trying to create a measure with a specific behaviour.

Both cycles and time are a simple SUM, nothing else. Cycles (#/h) measure is define as seen below.

Cycles (#/h) = DIVIDE([Cycles (#)],[Time (h)])
 

afbraga66_0-1699964235379.png

What I want a result is:

- If I have more than one Line selected (as the image) the total or subtotal should be 144.17 + 83.46 = 227.63

- If I have only one Line selected the total or subtotal should be either 144.17 or 83.46, depending on which is selected.

How can I achieve this?

Thank you.

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

Hi @afbraga66 ,

 

I suggest you to try code as below to create a measure.

Cycles (#/h) =
VAR _SUMMARIZE =
    SUMMARIZE (
        'TableName',
        'TableName'[Line],
        "Cycles", DIVIDE ( [Cycles (#)], [Time (h)] )
    )
RETURN
    SUMX ( _SUMMARIZE, [Cycles] )

 

Best Regards,
Rico Zhou

 

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

1 REPLY 1
v-rzhou-msft
Community Support
Community Support

Hi @afbraga66 ,

 

I suggest you to try code as below to create a measure.

Cycles (#/h) =
VAR _SUMMARIZE =
    SUMMARIZE (
        'TableName',
        'TableName'[Line],
        "Cycles", DIVIDE ( [Cycles (#)], [Time (h)] )
    )
RETURN
    SUMX ( _SUMMARIZE, [Cycles] )

 

Best Regards,
Rico Zhou

 

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

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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