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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
marsclone
Helper IV
Helper IV

IF Function

I'm struggling with (i think) an easy measure.

But can't get it to work.

 

I have an open item list from my customers.

I have a list with max limits for my customers.

 

I want to create a matrix which shows the total amount per customer and if the total amount exceeds the limit it must show the shortfall of this position.

Open item list
CustomerInvoiceAmount
A201901€ 250
A201902€ 350
B201903€ 600
B201904€ 400
B201905€ 200
C201906€ 390
C201907€ 250
C201908€ 600
C201909€ 800
   
  € 3.840

 

Limitlist
CustomerLimit
A€ 800
B€ 1.000
C

€ 2.000

 

Total list
CustomerAmountLimitShortfall
A6008000
B12001000-200
C20402000-40
    
 3840 -240
    

 

 

Which measure do i need for this?

 

Thank you in advance

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@marsclone 

 

Try this MEASURE

see attached file as well

 

Measure =
IF (
    HASONEFILTER ( LimitList[Customer] ),
    IF (
        SUM ( Open_item_list[Amount] ) > SUM ( LimitList[Limit] ),
        SUM ( LimitList[Limit] ) - SUM ( Open_item_list[Amount] ),
        0
    ),
    SUMX (
        VALUES ( LimitList[Customer] ),
        CALCULATE (
            IF (
                SUM ( Open_item_list[Amount] ) > SUM ( LimitList[Limit] ),
                SUM ( LimitList[Limit] ) - SUM ( Open_item_list[Amount] ),
                0
            )
        )
    )
)

View solution in original post

2 REPLIES 2
Zubair_Muhammad
Community Champion
Community Champion

@marsclone 

 

Try this MEASURE

see attached file as well

 

Measure =
IF (
    HASONEFILTER ( LimitList[Customer] ),
    IF (
        SUM ( Open_item_list[Amount] ) > SUM ( LimitList[Limit] ),
        SUM ( LimitList[Limit] ) - SUM ( Open_item_list[Amount] ),
        0
    ),
    SUMX (
        VALUES ( LimitList[Customer] ),
        CALCULATE (
            IF (
                SUM ( Open_item_list[Amount] ) > SUM ( LimitList[Limit] ),
                SUM ( LimitList[Limit] ) - SUM ( Open_item_list[Amount] ),
                0
            )
        )
    )
)

That worked really well!

 

So it must be in table form and not matrix?

 

Thank you!

 

 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.