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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
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.

Top Solution Authors