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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
marcos_osorio
Helper II
Helper II

Calculation and filter problem

Hi, sorry to bother you, because I think this is a quite easy problem, but unitl now, cannot solve it.

 

I have two tables:

 

TableA                                             TableB

Size                                                   Size

Country                                            Country

Price                                                 Price2

KEY (Size&Country)                         Units

                                                        Key(Size&Coutry)

The two tables are related with the Key Field.

 

The problem is that I want to show on an Table this:

Size   Country  Price    Price2    PriceUnits

 

Where PriceUnits is the sum of the Units in TableB who have a Price2 > Price + 1

I tried with:   PriceUnits = calculate(sum(Tableb[Units]), TableB[Price2] > TableA[Price] + 1), I even tried with related but seems to not enable me this option.

 

Can you help me?

 

Thank you very much.

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

Create a new column in table A

PriceUnits = sumx(filter(TableB, TableB[KEY (Size&Country)] = TableA[KEY (Size&Country)]  && TableB[Price2] > TableA[Price] ),Tableb[Units])

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
v-frfei-msft
Community Support
Community Support

Hi @marcos_osorio ,

 

We can create a calculated column in table A as below.

PriceUnits = var a = TableA[Price]+1
return
CALCULATE(SUM(TableB[Unit]),FILTER(TableB,TableB[Price]>a))

Capture.PNG

 

Pbix as attached. If it doesn't meet your requirement,  kindly share your sample data and excepted result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

 

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
amitchandak
Super User
Super User

Create a new column in table A

PriceUnits = sumx(filter(TableB, TableB[KEY (Size&Country)] = TableA[KEY (Size&Country)]  && TableB[Price2] > TableA[Price] ),Tableb[Units])

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
kentyler
Solution Sage
Solution Sage

try extracted a variable

 calculate(sum(Tableb[Units]), TableB[Price2] > TableA[Price] + 1),

VAR a_price = SELECTEDVALUE(TableA[Price]) + 1

CALCULATE(SUM(Tableb[Units]),TableB[Price2] > a_price)





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Solution Authors
Top Kudoed Authors