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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors