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
Anonymous
Not applicable

Calculated % measure

Hello, 

 

I have problems creating a measure, i want to show on a line chart the percentage of "orders on time" (1).

My power bi table looks like the first one with orders and itmes, and when I make this measure the result is 63%, but it really should be 60% , because it depens on the number of orders, not the number of itmes in the order.

 

My measure is sum(time)/count(order) = 7/11, and should be 3/5

 

How can I make the measure, without loosing the item column?

Capturafe.PNGPlease I need Help

1 ACCEPTED SOLUTION
v-cherch-msft
Employee
Employee

Hi @Anonymous

 

You may create measure as below:

Measure =
COUNTROWS ( SUMMARIZE ( FILTER ( Table1, Table1[Time] = 1 ), Table1[Order] ) )
    / DISTINCTCOUNT ( Table1[Order] )

aa.png

 

Regards,

Cherie

Community Support Team _ Cherie Chen
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

2 REPLIES 2
v-cherch-msft
Employee
Employee

Hi @Anonymous

 

You may create measure as below:

Measure =
COUNTROWS ( SUMMARIZE ( FILTER ( Table1, Table1[Time] = 1 ), Table1[Order] ) )
    / DISTINCTCOUNT ( Table1[Order] )

aa.png

 

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous

 

Try this one

 

Measure =
VAR orderswithTime1 =
    COUNTROWS (
        FILTER ( VALUES ( Table1[Order] ), CALCULATE ( SUM ( Table1[Time] ) ) > 0 )
    )
VAR TotalOrders =
    COUNTROWS ( VALUES ( Table1[Order] ) )
RETURN
    DIVIDE ( orderswithTime1, TotalOrders )

Regards
Zubair

Please try my custom visuals

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.