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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
ZZZZZZZ37
Frequent Visitor

SELECT VALID DATE USING POWER BI DAX

Hi Power BI Community, 

 

Disclaimer: New to Power BI and learning is still in progress.

 

My Team and I are working on some date to filter the schedule of employees. We are checking the log out date of the employees. But we are getting multiple dates so what we did is we tried to filter it using time difference between attendance and the scheduled date. Please see below sample.

 

ZZZZZZZ37_0-1669472168115.png

We are getting some problems on the out_is_valid column. It should only return "1" on the same schedule date as the in_is_valid column which are highlighted in green. But we are getting another "1" value which is in blue highlight. How can we only select the IN and OUT date with the same sched start and end? Below is our code.

 

ZZZZZZZ37_1-1669472291416.png

 

Thanks for your help.

2 REPLIES 2
amitchandak
Super User
Super User

@ZZZZZZZ37 , Based on what I got

 

new column =

var _max = maxx(filter(Table, [User] = earlier([User]) && [Schedule Date] = earlier([Schedule Date]) && && [Schedule Start Time] = earlier([Schedule Start Time])  && && [Schedule End Time] = earlier([Schedule End Time]) && [Case] = "Out") ,  [attendance out])

var _count= maxx(filter(Table, [User] = earlier([User]) && [Schedule Date] = earlier([Schedule Date]) && && [Schedule Start Time] = earlier([Schedule Start Time])  && && [Schedule End Time] = earlier([Schedule End Time]) && [Case] = "in") ,  [attendance out])

return

if(not(isblank(_cnt) )  && _max = [attendance out], 1, 0 )

 

 

Power BI DAX- Earlier, I should have known Earlier: https://youtu.be/CVW6YwvHHi8

 

If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hi @amitchandak , 

 

Thanks for your reply. I tried the code that you sent but I didn't quite get it. Please see attached pbix. You may refer on the trial_out column.

 

https://drive.google.com/file/d/1bUfmHrrm957mEdh4-utKOrFqfIdlPQ2Y/view?usp=sharing

 

Regards,

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.