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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
gvg
Post Prodigy
Post Prodigy

Using table as filter in power bi

Hi all,

I am trying to solve this probably simple problem but came up with strange result. I have a tLevels table with different grouping levels like this:

 

Lev1     Lev2     ProductID

1        12       A

1        12       B

1        4321     C

2        133      D

2        12       E

 

then I have a sales tSales table:

 

ProductID  Amount

A          100

A           10

B          200

B          150

C           80

D          300

E          260

 

The tables are related via ProductID. I was expecting to sum ProductIDs by Lev1 with

 

SumAmount = CALCULATE(SUM(tSales[Amount]),tLevels[Lev1]) 

 

However I get this strange result 

 

 test.JPG

 

Any ideas why is it not summing by Lev1 giving me the same result on all lines?

 

 

 

1 ACCEPTED SOLUTION

Well, it works well for me based on the sample data you provided.

You can check the desktop file I created with your data and compare to yours.

 

https://superfarb.com/wp-content/uploads/2017/07/Levels.pbix_.zip

 

 

 

Ziv Himmelfarb

https://www.superfarb.com

View solution in original post

7 REPLIES 7
zivhimmel
Resolver I
Resolver I

If you want to show Amount by Lev1,

the measure will simple be =SUM(Amount).

You don't even have to create a measure for it, just create a visual with tLevels[Lev1] and tSales[Amount]

and make sure the aggregation used for tSales[Amount] is SUM.

 

The problem with the measure you've created is that CALCULATE changes the context filter for the fields you are filtering by

(in this case tLevels[Lev1]). The second argument to CALCULATE is a flter. You just used tLevels[Lev1] as a filter,

which always returns TRUE, therefore all values are the same.

 

I hope that helps.

 

Ziv Himmelfarb

https://www.superfarb.com

 

Thanks for the comments. I actually tried to put up a table visual without any measures before posting this question. It returns even more strange result:

 

test2.JPG

My table relationship looks like:

 

test3.JPG

 

It doesn't help if Cross filter direction is Both or Single.

Any page level or report level filters in use?

No.

 

test4.JPG

Well, it works well for me based on the sample data you provided.

You can check the desktop file I created with your data and compare to yours.

 

https://superfarb.com/wp-content/uploads/2017/07/Levels.pbix_.zip

 

 

 

Ziv Himmelfarb

https://www.superfarb.com

Your example works fine. I investigated thoroughly my data set and found out that product A had some odd non-printables in tSales.

Thanks!

tjd
Impactful Individual
Impactful Individual

Anytime you see a result like this (all values returned are the same) it usually means that your table relationships are not set correctly between your tLevels and tSales tables.  Try looking at the relationship flow between your tables and select the other choice (one or both).

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.