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
Carlaf
Frequent Visitor

Calculate number of customers with condition

Good morning,

 

i've got a model with two tables.

Tabel 1 contains:

customer, data, sales, budget

 

and Table 2 contains:

customer, old credit's value,

 

-->i woul like to calculate the number of customers' that have a negative difference between budget and old credit's value.

 

How can i do it?

Thanks

C

 

1 ACCEPTED SOLUTION
v-yadongf-msft
Community Support
Community Support

Hi @Carlaf ,

 

Please create a new column in table2:

New_Budget = IF('Table2'[Year] = 2021,LOOKUPVALUE('Table1'[Budget],'Table1'[Customer],'Table2'[Customer]))

vyadongfmsft_2-1665566986745.png

 

Do you just want to count the numbers of 2021?

Count = SUMX('Table2',IF('Table2'[New_Budget] < 'Table2'[Old credit's value] && 'Table2'[New_Budget] <> BLANK(), 1 , 0 ))

vyadongfmsft_1-1665566960072.png

 

If I misunderstand your demands, please feel free to contact us in time.

 

Best regards,

Yadong Fang

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

5 REPLIES 5
v-yadongf-msft
Community Support
Community Support

Hi @Carlaf ,

 

Please create a new column in table2:

New_Budget = IF('Table2'[Year] = 2021,LOOKUPVALUE('Table1'[Budget],'Table1'[Customer],'Table2'[Customer]))

vyadongfmsft_2-1665566986745.png

 

Do you just want to count the numbers of 2021?

Count = SUMX('Table2',IF('Table2'[New_Budget] < 'Table2'[Old credit's value] && 'Table2'[New_Budget] <> BLANK(), 1 , 0 ))

vyadongfmsft_1-1665566960072.png

 

If I misunderstand your demands, please feel free to contact us in time.

 

Best regards,

Yadong Fang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Carlaf
Frequent Visitor

I couldn't add the pbix format.

Carlaf_0-1665559264152.pngCarlaf_1-1665559293934.png

 

 

Shaurya
Memorable Member
Memorable Member

Hi @Carlaf,

 

I would first pull the old credit value in the first table by using LOOKUPVALUE to create a new column.

 

Old Credit Value = LOOKUPVALUE('Table 2'[Old Credit Value],'Table 2'[Customer],'Table 1'[Customer])

 

Then count rows by using:

 

Count = SUMX('Table 1',IF('Table 1'[Budget]<'Table 1'[Old Credit Value],1,0)

 

Works for you? Mark this post as a solution if it does!
Consider taking a look at my blog: Forecast Period - Graphical Comparison 

Hi,

thanks for your answer.

For the first step i've got this error

Carlaf_0-1665557582880.png

Maybe because i also have a data field in the second table... and it gives more data

Hi,

Can you attach the sample data not in image format?

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