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

Count number of values in between a range from other table

Hello - looking for suggestions on how to solve this. I have one table table1 which has column price, item, subitem  and another table table 2 with item, subitem, start price, end price. I want to create a column in table2 which gives count of records with price in table 1 falling between the start price and end price values of table2 for a particular item, sub-item.

 

ss_pbi_og_0-1669404091214.png

ss_pbi_og_1-1669404103810.png

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Write this calculated column formula in Table2

Count = calculate(countrows(table1),filter(table1,table1[item]=earlier(table2[item])&&table1[subitem]=earlier(table2[subitem])&&table1[price]>=earlier(table2[startprice])&&table1[price]<=earlier(table2[endprice])))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@Ashish_Mathur it worked exactly as i wanted. Thank you.

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Hi,

Write this calculated column formula in Table2

Count = calculate(countrows(table1),filter(table1,table1[item]=earlier(table2[item])&&table1[subitem]=earlier(table2[subitem])&&table1[price]>=earlier(table2[startprice])&&table1[price]<=earlier(table2[endprice])))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.