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
micheledubose
Resolver II
Resolver II

More data is returned than expected when using a page filter in Power BI Desktop

Hello,

I have a tabular model project where I've importing data by writing the below query.

SELECT myDateColumn, phoneNumber, myDurationColumn
FROM myTable
WHERE
(
myDateColumn BETWEEN to_date('08-01-2016 02:00:00','dd-mm-yyyy hh24:mi:ss') AND to_date('08-01-2016 02:10:00','dd-mm-yyyy hh24:mi:ss')
AND
myDurationColumn > 0
)

I've created a Power BI Desktop report and connected to the SSAS data source.  The results in my report are correct. In that, what's returned is 13 records.  In the query below, I remove the myDateColumn expression from the WHERE clause. In my Power BI Desktop report, I add a page filter like the image below, however, what's returned is more than 13 records.  I'm still learning how Power BI and SSAS work, so could someone explain the reason for these behaviors?  My requirement is to not have the myDateColumn filtered in the query but to create a page filter where users can choose which date from myDateColumn to select.

SELECT myDateColumn, phoneNumber, myDurationColumn
FROM myTable
WHERE
(

myDurationColumn > 0
)

 

micheledubose_1-1611855680251.png

 

1 ACCEPTED SOLUTION
micheledubose
Resolver II
Resolver II

I've realized my error.  I was not testing apples to apples.  I was comparing test results from this query:

 

SELECT myDateColumn, phoneNumber, myDurationColumn
FROM myTable
WHERE
(
myDateColumn BETWEEN to_date('08-01-2016 00:00:00','dd-mm-yyyy hh24:mi:ss') AND to_date('08-01-2016 00:10:00','dd-mm-yyyy hh24:mi:ss')
AND
myDurationColumn > 0
)

 

and this query:

 

SELECT myDateColumn, phoneNumber, myDurationColumn
FROM myTable

LEFT JOIN table2

ON myTable.column_name = table2.column_name;
WHERE
(
myDurationColumn > 0
)

 

So when I ran the report, the second query returned unexpected results because of the join.

 

View solution in original post

12 REPLIES 12
parry2k
Super User
Super User

@micheledubose wow, glad you figured it out, certain things are very hard to figure out without having the full picture.

 

Enjoy!!

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k 

Yes.  Sorry for the confusion and thank you for your help.

micheledubose
Resolver II
Resolver II

I've realized my error.  I was not testing apples to apples.  I was comparing test results from this query:

 

SELECT myDateColumn, phoneNumber, myDurationColumn
FROM myTable
WHERE
(
myDateColumn BETWEEN to_date('08-01-2016 00:00:00','dd-mm-yyyy hh24:mi:ss') AND to_date('08-01-2016 00:10:00','dd-mm-yyyy hh24:mi:ss')
AND
myDurationColumn > 0
)

 

and this query:

 

SELECT myDateColumn, phoneNumber, myDurationColumn
FROM myTable

LEFT JOIN table2

ON myTable.column_name = table2.column_name;
WHERE
(
myDurationColumn > 0
)

 

So when I ran the report, the second query returned unexpected results because of the join.

 

parry2k
Super User
Super User

@micheledubose isn't it supposed to be AM than PM?

 

It is at the point where I'm out of ideas, if you can share pbix file (remove sensitive information) before sharing, I can take a look. It shouldn't be this hard, there is something else going on and I have a fear that you are not comparing apple to apple, but I have no way of knowing what is going on.

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k ,

Most of the data in my .pbix file is sensitive but I will see what I can share.  I do have another question however.  I tried testing the data by filtering on a different date range.  It seems to be duplicate records which could explain the difference in count of rows.  In the image below, next to date: 1/16/2016 12:00:45 AM, there's a number "3".  This displays on the report that has the page filter.  However, for the report that connects to the SQL query where date is filtered, 1/16/2016 12:00:45 AM has a number "1" next to it.  Does this mean that there's 3 records with 1/16/2016 12:00:45 AM data on the report where I have the page filter for date?


Report display with page filtering date:

micheledubose_1-1611936116305.png

 

 

Hi , @micheledubose 

Yes, this mean that there's 3 records with 1/16/2016 12:00:45 AM data on  your original  table. 

 

I conducted related tests regarding your question, but did not find any related issues.

11.png

 

Did you miss other filter conditions that led to inconsistent results?

 

 

Best Regards,
Community Support Team _ Eason

 

 

parry2k
Super User
Super User

@micheledubose doesn't make sense, you have time in your query but in the filter, you have not specified time and also it should not be on or before, it should be before only, you don't want to include 09/01 data, why you have on or before, it should before only.

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hi @parry2k ,

I do not see an "on" condition.  I've added the time in my filter for 01/08/2016 as such and still get more data than expected.  

micheledubose_0-1611862718384.png

 

I've also tried the below and still do not get the expected result.

 

micheledubose_1-1611862839564.png

 

 

parry2k
Super User
Super User

@micheledubose in SQL Statement you are getting data between :

 

08-01-2020 2:00 AM to 08-01-2020 2:10AM

 

whereas in filter your range is :

 

08-01-2020 to 09-01-2020 (basically two days data) which is a larger range than in your SQL statement.

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k ,

In the page filter in my report, if I choose 01/08/2016 as the end date, I do not get results back. Hence, choosing 01/09/2016 instead.

 

HotChilli
Super User
Super User

Am i missing something?   Shouldn't the test be done with the same dates/times in the filter as the SQL statement?

Hi @HotChilli ,

 

The filter date range in my report is 01/08/2016 to 01/09/2016 because if I select 01/08/2016 to 01/08/2016, I do not get results back. Hence, selecting 01/09/2016 instead.

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.