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

Preparing for a certification exam? Ask exam experts all your questions on May 15th. Register now.

Reply
AmeenVanakar
Advocate II
Advocate II

Filters created using calculated table does not give the desired result - Need Help

Hi,

The values of visits don't match when I use the filters I created using calculated tables. Here is a scenario & attached is the sample .pbix file Analysis.pbix

 

AmeenVanakar_2-1728036805403.png

 

I have created 2 tables & linked them to the master data for filter purposes.

Table 1Customer Mobile Number shows customers' unique mobile numbers, and their unique visits i.e. distinct count of invoice numbers/bill numbers along with a DAX-based grouping defining if the customer has visited once, twice, thrice & so on.

AmeenVanakar_0-1728036446861.png

 

Table 2 = Unique Bill Number which shows list of all unique invoice numbers/bill number, corresponding total bill value & a grouping to show the bucket the invlice falls in i.e. below 1000, 1000-2000 & so on.

AmeenVanakar_1-1728036516448.png

 

2 ACCEPTED SOLUTIONS
HotChilli
Super User
Super User

I think you are telling us that you filtered for 2'visits' from the slicer but the table visual shows 1 'visit' for some records.

The other slicer has affected the result. Let's look at the first row.  For the 5286 mobile there are 2 distinct 'bill no' in the customer data (ending 6309 and 2566) but there are 3 records for 6309. Individually , each row has bill value < 1000 but when you constructed the dimension table 'unique bill number', you added the value of each record, so it added up to more than 1000. That value was used in the 2nd slicer.

So your table visual is 'show me mobile numbers with 2 visits and, of those visits, show me mobile numbers which have total bill value of less than 1000'.  Hence only 1 'visit' qualifies.

View solution in original post

lbendlin
Super User
Super User

You are liberally mixing columns from the fact table and the dimension tables. Guidance is to use columns from the dimension tables for filtering, and columns from the fact table for counting.

 

I also adjusted your SWITCH statements. They were the wrong way round.

 

 

View solution in original post

7 REPLIES 7
lbendlin
Super User
Super User

You are liberally mixing columns from the fact table and the dimension tables. Guidance is to use columns from the dimension tables for filtering, and columns from the fact table for counting.

 

I also adjusted your SWITCH statements. They were the wrong way round.

 

 

Hi @lbendlin 

If we filter the data by calendar date, the numbers don't seem to match again. Is there a solution to this?

 

AmeenVanakar_0-1728447840232.png

 

Please provide sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.

The expected outcome should match as follows;

- There are 186 invoices with bill value below $1,000 from 1st Sep 2024 to 30th Sep 2024.

- Only a few out of these 186 invoices are generated from customers (unique mobile no.) who visited thrice within this date range as shown in the expected outcome. Rest have either visited twice or once only & such customers should not be excluded when we filter for 3 visits.

 

Here is the full data along with the current (grey) vs expected outcome (green).

Report.pbix

 

AmeenVanakar_2-1728474686292.png

lbendlin_0-1729299016208.png

This is a calculated column that is not impacted by the filters in your data model.

lbendlin_1-1729299148121.png

You need to use a measure instead.

 

 

HotChilli
Super User
Super User

I think you are telling us that you filtered for 2'visits' from the slicer but the table visual shows 1 'visit' for some records.

The other slicer has affected the result. Let's look at the first row.  For the 5286 mobile there are 2 distinct 'bill no' in the customer data (ending 6309 and 2566) but there are 3 records for 6309. Individually , each row has bill value < 1000 but when you constructed the dimension table 'unique bill number', you added the value of each record, so it added up to more than 1000. That value was used in the 2nd slicer.

So your table visual is 'show me mobile numbers with 2 visits and, of those visits, show me mobile numbers which have total bill value of less than 1000'.  Hence only 1 'visit' qualifies.

Hi @HotChilli 

Thanks. This makes sense.

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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