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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Justas4478
Responsive Resident
Responsive Resident

Calculating percentage between two numbers with ability to capture abnormalities

Hi, I am trying to create a 'Fullfilment Rate' measure that calculates percentages between two values and show is as a %.
Ideally maximum % should be 100% but if it brings back more than 100% it should display something like 'Over Demand' or something that would make sense as and error message.
This is example screenshot.

Justas4478_0-1706606522477.png

Thanks.

1 ACCEPTED SOLUTION

@zenisekd I created this measure: 

DIVIDE('Outbound Delivery'[Total Actual],'Outbound Delivery'[Total Demand],0) * 1
It seasm to be working and it got rid of additional rows.
The lines might have something to do with the formating function.

View solution in original post

18 REPLIES 18
zenisekd
Super User
Super User

 try:
=
IF (
    DISTINCTCOUNT ( table[DocumentNumber] ) = 1,
    IF (
        DIVIDE ( [TotalActual] [TotalDemand]  ) > 1,
        "Over Demand",
        FORMAT (
            DIVIDE ( [TotalActual] [TotalDemand] ),
            "Percent"
        )
    )
)

Kudos and mark as solution appreciated.

@zenisekdHi, unfortunately it does not work since my Total Actual and Demand are measures and not columns.
Sorry for not including in initial request message.

I adjusted it to work with measures.

@zenisekd It is working, but for some reason it creates additional rows.

Justas4478_0-1706614004372.png

 

Ok, try just    

IF (
        DIVIDE ( [TotalActual] [TotalDemand]  ) > 1,
        "Over Demand",
        FORMAT (
            DIVIDE ( [TotalActual] [TotalDemand] ),
            "Percent"
        )
    )

@zenisekd Still same, the only change was that 'Over Demand' now is showin in Total line.

Justas4478_0-1706615774596.png

 

Yeah, that is what was the first part for... in that case stick to the previous:
=
IF (
    DISTINCTCOUNT ( table[DocumentNumber] ) = 1,
    IF (
        DIVIDE ( [TotalActual] [TotalDemand]  ) > 1,
        "Over Demand",
        FORMAT (
            DIVIDE ( [TotalActual] [TotalDemand] ),
            "Percent"
        )
    )
)

And apply a filter on top of the visual saying that Fulfilment Rate must not be blank/empty...

@zenisekd I dont know is this helpfull but DocumentNumber sits in 'Outbound Delivery Documents' table where Total Actual and Demand sits in 'Outbound Delivery' table.
Maybe that is causing additional lines?

@zenisekd What I noticed is that measure is trying to calculate for each 'ItemNumber' for each 'DocumentNumber' even when there is no Actual or Demand data in them.

Justas4478_0-1706616499581.png

 

As I said previously, just filter the blanks out on the visual. I don't have the sample data to play with it so, I consider this the best solution. 

@zenisekd I just tried to add is not blank filter like you suggested, but it did not work for some reason.
It does not allow me to enter any text only asking for numbers.

Justas4478_0-1706618555542.png

 

use "is not empty" instead.

@zenisekd I don't get is not emply as available chaices on the list.

Justas4478_0-1706620005177.png

 

I tried to replicate this on my sample data and it is there. 

zenisekd_0-1706622316414.png

...

@zenisekd I created this measure: 

DIVIDE('Outbound Delivery'[Total Actual],'Outbound Delivery'[Total Demand],0) * 1
It seasm to be working and it got rid of additional rows.
The lines might have something to do with the formating function.

I am confused here, previously you said, that it is two measures and that you want the text there, if it is over 1...?

@zenisekd Yes, but as you seen trying to add text for some reason creates addition rows.
And for some reason removing blanks does not remove them and I don't get choice to remove empty.

Justas4478
Responsive Resident
Responsive Resident

The 'Total Actual' and 'Total Demand' are a measures and not a column.

Justas4478_0-1706607737340.png

I cant create calculated columns since I am using company data model that is Live connected.

Justas4478_1-1706607802258.png

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.