Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi all,
I've watched a lot of videos and functions on my own, but none of them solved my problem, so I beg you to help me. I now have two forms,One is the vehicle entry form and the other is the vehicle inspection form.There is a date table between them that serves as a bridge to connect.The date table is 1 port, and the vehicle inspection table and vehicle admission table are multi-port.
1. I would like to find out if the vehicle has been inspected at this month of year.
2. And to find out which vehicles were inspected before they entered the park.
I would like to compare the vehicles in the vehicle entry form with the vehicle inspection list to see if the vehicles entering the park have been inspected before entering the park.
I would like to create a new column in the vehicle entry table named "Inspected Vehicles1"
Analyze the vehicle inspection form and the vehicle entry form line by line, and first compare whether the entry form the column of" year and month" in the entry form are consistent with the column of "year and month" in the inspection form; If it is consistent, compare whether the license plate numbers in the two tables are the same, and return the license plate number if they are the same; If the time of "year and month" are inconsistent, the system is empty.
I would like to find out if the vehicle has been inspected at this month of year.
I would like to create a new column in the vehicle entry table named "Inspected Vehicles2"
Perform a line-by-line analysis of the vehicle entry form and the vehicle inspection form, first compare whether the entry time in the emtry form is earlier than the data in each row of the inspection table, and if so, return empty. If not, compare them line by line, and match the license plate number in the park entry checklist line by line in the inspection form.
My goal was to find out which vehicles were inspected before they entered the park.
please help me,much appreciated.
Solved! Go to Solution.
Hi, @Yumikang
You can try the following dax to achieve your need.
DAX:
currentMonthisIspection =
IF (
NOT (
ISBLANK (
LOOKUPVALUE (
'Vechicle inspection form'[license plate number],
'Vechicle inspection form'[license plate number], 'Vehicle entry form'[license plate number],
'Vechicle inspection form'[YearMonth], 'Vehicle entry form'[YearMonth]
)
)
),
'Vehicle entry form'[license plate number],
"Null"
)
Checked prior to entry =
VAR _entryDate = 'Vehicle entry form'[entry time]
VAR _plateNumber = 'Vehicle entry form'[license plate number]
VAR _year =
YEAR ( 'Vehicle entry form'[entry time] )
VAR _month =
MONTH ( 'Vehicle entry form'[entry time] )
VAR _day =
DAY ( 'Vehicle entry form'[entry time] )
VAR _inspectionDate =
LOOKUPVALUE (
'Vechicle inspection form'[inspection date],
'Vechicle inspection form'[license plate number], _plateNumber,
'Vechicle inspection form'[inspection date],
CALCULATE (
MIN ( 'Vechicle inspection form'[inspection date] ),
FILTER (
'Vechicle inspection form',
'Vechicle inspection form'[license plate number] = _plateNumber
&& YEAR ( 'Vechicle inspection form'[inspection date] ) = _year
&& MONTH ( 'Vechicle inspection form'[inspection date] ) = _month
&& DAY ( 'Vechicle inspection form'[inspection date] ) > _day
)
)
)
RETURN
IF ( NOT ( ISBLANK ( _inspectionDate ) ), _plateNumber, "NUll" )
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hi, @Yumikang
You can try the following dax to achieve your need.
DAX:
currentMonthisIspection =
IF (
NOT (
ISBLANK (
LOOKUPVALUE (
'Vechicle inspection form'[license plate number],
'Vechicle inspection form'[license plate number], 'Vehicle entry form'[license plate number],
'Vechicle inspection form'[YearMonth], 'Vehicle entry form'[YearMonth]
)
)
),
'Vehicle entry form'[license plate number],
"Null"
)
Checked prior to entry =
VAR _entryDate = 'Vehicle entry form'[entry time]
VAR _plateNumber = 'Vehicle entry form'[license plate number]
VAR _year =
YEAR ( 'Vehicle entry form'[entry time] )
VAR _month =
MONTH ( 'Vehicle entry form'[entry time] )
VAR _day =
DAY ( 'Vehicle entry form'[entry time] )
VAR _inspectionDate =
LOOKUPVALUE (
'Vechicle inspection form'[inspection date],
'Vechicle inspection form'[license plate number], _plateNumber,
'Vechicle inspection form'[inspection date],
CALCULATE (
MIN ( 'Vechicle inspection form'[inspection date] ),
FILTER (
'Vechicle inspection form',
'Vechicle inspection form'[license plate number] = _plateNumber
&& YEAR ( 'Vechicle inspection form'[inspection date] ) = _year
&& MONTH ( 'Vechicle inspection form'[inspection date] ) = _month
&& DAY ( 'Vechicle inspection form'[inspection date] ) > _day
)
)
)
RETURN
IF ( NOT ( ISBLANK ( _inspectionDate ) ), _plateNumber, "NUll" )
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hi, @Yumikang
It's hard to understand the final effect you want to achieve by just reading the text you gave, you can share the pbix file without sensitive data for testing and share the final effect you want to achieve and the description of the logic to achieve it in the form of a screenshot. This will help you to solve the problem faster.
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Thanks for the reply, I've got the test file ready, but how do I send the attachment? I didn't find the option to add an attachment.
Hi, @Yumikang
You can use oneDrive or GoogleDrive to share the pbix file(Share the link).
Best Regards,
Yang
Community Support Team
Hi, @Yumikang
Sorry, the links you shared doesn't open. I'm not a user in your organization.
If the amount of data used for the test is small, you can just copy your table, same as the posters below.
Solved: Return if one condition OR another is met - Microsoft Fabric Community
If you have a large amount of data, you can use GoogleDrive or OneDrive to share your links.
Solved: RANKX Measure failing to return correct results af... - Microsoft Fabric Community
Best Regards,
Yang
Community Support Team
Table 2: Vehicle inspection form
| Inspection time | inspection date | license plate number |
| 2024/6/6 14:26 | 2024/6/6 | 赣CBM197 |
| 2024/6/6 14:30 | 2024/6/6 | 粤AS3119 |
| 2024/6/6 14:32 | 2024/6/6 | 粤A3E96Q |
| 2024/6/6 14:34 | 2024/6/6 | 粤A5V11T |
| 2024/6/6 19:30 | 2024/6/6 | 粤SC7896 |
| 2024/6/7 9:47 | 2024/6/7 | 粤AAU516 |
| 2024/6/7 9:54 | 2024/6/7 | 粤AAY123 |
| 2024/6/7 9:57 | 2024/6/7 | 鄂FL5105 |
| 2024/6/7 15:46 | 2024/6/7 | 粤WN2003 |
| 2024/6/7 15:51 | 2024/6/7 | 皖N33046 |
| 2024/6/7 16:00 | 2024/6/7 | 粤A38VN6 |
| 2024/6/11 12:02 | 2024/6/11 | 粤BHY138 |
| 2024/6/12 10:13 | 2024/6/12 | 桂P50183 |
| 2024/6/14 13:21 | 2024/6/14 | 粤ABK276 |
| 2024/6/14 16:01 | 2024/6/13 | 鲁Q395JE |
| 2024/6/16 10:28 | 2024/6/16 | 鄂FF7380 |
| 2024/6/16 14:01 | 2024/6/16 | 粤SE8569 |
| 2024/6/16 14:03 | 2024/6/16 | 粤SE7753 |
| 2024/6/24 9:12 | 2024/6/23 | 豫D97738 |
| 2024/6/24 17:08 | 2024/6/24 | 粤AAL951 |
| 2024/6/24 17:08 | 2024/6/24 | 粤AAL993 |
| 2024/6/27 14:26 | 2024/6/29 | 豫J76313 |
| 2024/6/27 14:26 | 2024/6/29 | 豫JY773 |
| 2024/7/8 11:06 | 2024/7/8 | 豫J76313 |
| 2024/7/16 19:42 | 2024/7/16 | 粤AAS759 |
| 2024/7/18 14:43 | 2024/7/18 | 9.6飞翼 |
| 2024/7/19 8:50 | 2024/7/19 | 粤AAN203 |
| 2024/7/19 9:01 | 2024/7/19 | 鄂L57186 |
| 2024/7/19 15:53 | 2024/7/19 | 粤AJD156 |
| 2024/7/20 14:17 | 2024/7/20 | 赣C1155E |
| 2024/7/20 14:19 | 2024/7/20 | 赣C3882E |
Table 3: time form
| date |
| 202401 |
| 202402 |
| 202403 |
| 202404 |
| 202405 |
| 202406 |
| 202407 |
| 202408 |
| 202409 |
| 202410 |
| 202411 |
| 202412 |
The relationship I'm trying to model is this
I want to create 2 new columns in the vehicle entry table
1.Compare if this vehicle was inspected in a certain month. For example, if the entry time is 202406 in entry form, then look for 202406 in the vehicle inspection form to see if there is a license plate number for this vehicle.
If there is, return this license plate number, if not, return empty.
2.In a given month, compare whether the car was inspected before it was admitted to entry the park. For example, if the entry time of “粤 AA036” in the Vehicle Entry Table is 2024/06/23, then see if there is this license plate number in the Vehicle Inspection form between 2024/06/01 and 2024/06/22. If there is, return this license plate number, if not, return empty.
3.Table 3 shows my slicer, with which I filtered the formulated months.
Could you open the link to view?
thank for your reply.
Table 1: Vehicle Entry Form
| license plate number | entry time |
| 粤AAL068 | 2024-04-27 15:42:00 |
| 粤AAL068 | 2024-04-27 23:17:42 |
| 豫D97738 | 2024-04-27 22:16:00 |
| 粤BHY138 | 2024-04-27 09:28:18 |
| 粤BHY138 | 2024-04-27 19:40:33 |
| 粤SE8569 | 2024-04-27 20:13:56 |
| 皖N33046 | 2024-05-07 09:55:30 |
| 粤AAL068 | 2024-05-07 10:28:48 |
| 皖A7S688 | 2024-05-10 08:54:30 |
| 皖KZ2323 | 2024-05-10 18:37:44 |
| 粤AAN203 | 2024-05-13 13:04:04 |
| 粤AH5840 | 2024-05-13 15:16:48 |
| 粤AFA771 | 2024-05-14 09:48:48 |
| 粤AFA771 | 2024-05-15 09:40:20 |
| 皖LG1744 | 2024-05-16 09:15:29 |
| 湘AL0686 | 2024-05-16 09:54:56 |
| 皖A7S566 | 2024-05-16 14:59:15 |
| 粤AH5840 | 2024-05-16 15:13:48 |
| 粤A38VN6 | 2024-05-21 12:05:49 |
| 粤AFA771 | 2024-05-22 09:18:31 |
| 粤AAL951 | 2024-05-22 11:34:03 |
| 皖A7S566 | 2024-05-22 14:43:12 |
| 粤AFA771 | 2024-05-23 10:30:12 |
| 粤AGR853 | 2024-05-23 12:30:15 |
| 皖A7Q066 | 2024-05-23 12:29:41 |
| 粤SC7896 | 2024-06-15 19:48:08 |
| 鄂E36493 | 2024-06-16 10:49:19 |
| 鄂E36493 | 2024-06-16 20:52:37 |
| 粤SE8569 | 2024-06-16 09:55:04 |
| 鄂FF7380 | 2024-06-16 19:23:19 |
| 鄂FF7380 | 2024-06-16 19:11:29 |
| 粤BHY138 | 2024-06-16 20:42:58 |
| 粤BMP652 | 2024-06-17 07:46:34 |
| 豫P97738 | 2024-06-17 13:32:55 |
| 粤ABK276 | 2024-06-24 14:48:52 |
| 皖A7S299 | 2024-06-24 16:21:49 |
| 皖A7S299 | 2024-06-24 14:49:05 |
| 粤AAL993 | 2024-06-25 10:06:14 |
| 粤ABK276 | 2024-06-25 10:08:28 |
| 皖A7J099 | 2024-07-03 14:32:22 |
| 皖A7J099 | 2024-07-03 14:32:32 |
| 粤AAU918 | 2024-07-04 11:03:27 |
| 粤AA33777 | 2024-07-05 22:30:30 |
| 粤J25Q08 | 2024-07-15 10:37:10 |
| 皖A7N299 | 2024-07-15 11:10:42 |
| 皖A7N299 | 2024-07-15 11:10:29 |
| 粤WN2003 | 2024-07-19 11:32:07 |
| 粤WN2003 | 2024-07-19 11:17:15 |
| 鄂L57186 | 2024-07-19 11:42:15 |
| 鄂L57186 | 2024-07-19 11:42:26 |
| 粤ABK276 | 2024-07-19 12:28:17 |
| 粤AFA771 | 2024-07-19 14:50:15 |
| 粤ABK276 | 2024-07-19 16:05:46 |
| 粤AJD156 | 2024-07-20 08:55:08 |
| 粤ABK276 | 2024-07-21 09:38:44 |
| 粤AAL993 | 2024-07-22 09:33:19 |
| 粤AAU918 | 2024-07-22 09:48:47 |
| 粤AFA771 | 2024-07-22 10:48:23 |
| 粤AD94G1 | 2024-07-22 13:47:08 |
| 粤BMP652 | 2024-06-17 17:07:15 |
| 粤SC7896 | 2024-06-17 09:26:43 |
| 粤SH5599 | 2024-06-17 10:43:59 |
| 粤SC7896 | 2024-06-17 17:38:36 |
| 皖N33046 | 2024-06-25 08:29:58 |
| 粤AAZ707 | 2024-06-25 11:50:12 |
| 粤ABC392 | 2024-06-24 08:38:24 |
| 豫P97738 | 2024-06-24 09:58:56 |
| 鲁Q395JE | 2024-06-24 12:37:29 |
| 粤BHY138 | 2024-06-24 08:59:36 |
| 粤BMP652 | 2024-06-25 11:00:35 |
| 鄂E36493 | 2024-06-25 16:14:05 |
| 鲁Q395JE | 2024-06-26 07:19:26 |
| 赣C3178E | 2024-06-25 08:42:51 |
| 粤BHY138 | 2024-06-25 09:03:54 |
| 鄂FF7380 | 2024-06-26 06:03:55 |
| 赣C3178E | 2024-06-26 09:09:49 |
| 鄂FF7380 | 2024-06-26 06:03:44 |
| 鄂FF7380 | 2024-06-26 18:14:27 |
| 鄂FF7380 | 2024-06-26 18:14:18 |
| 沪D75818 | 2024-07-04 09:35:13 |
| 沪D75818 | 2024-07-04 16:42:50 |
| 皖N33046 | 2024-07-05 09:12:40 |
| 粤ABC392 | 2024-07-04 14:51:18 |
| 沪D75818 | 2024-07-05 08:44:49 |
| 豫J76313 | 2024-07-05 13:24:51 |
| 赣C3882E | 2024-07-05 09:51:46 |
| 赣C3178E | 2024-07-05 08:48:04 |
| 鄂FLX789 | 2024-07-05 16:47:33 |
| 鄂FLX789 | 2024-07-05 16:47:25 |
| 粤ABC392 | 2024-07-16 10:42:17 |
| 沪D75818 | 2024-07-19 07:34:53 |
| 沪ES2758 | 2024-07-19 08:35:54 |
| 沪D75818 | 2024-07-19 15:56:32 |
| 沪ES2758 | 2024-07-19 17:34:32 |
| 粤ABC392 | 2024-07-19 10:53:47 |
| 粤ABC392 | 2024-07-19 16:03:32 |
| 沪D75818 | 2024-07-20 11:04:45 |
| 皖N33046 | 2024-07-22 09:05:06 |
| 粤ABC392 | 2024-07-20 13:50:37 |
| 沪D75818 | 2024-07-21 07:49:56 |
| 赣C3178E | 2024-07-21 09:30:58 |
| 赣C1303E | 2024-07-21 10:44:44 |
| 赣C1155E | 2024-07-21 10:05:45 |
| 粤SE8569 | 2024-07-21 11:27:12 |
| 沪ES2758 | 2024-07-21 10:48:57 |
| 沪ES2758 | 2024-07-21 20:56:14 |
| 沪D75818 | 2024-07-21 19:35:55 |
| 苏E21216 | 2024-07-21 13:07:05 |
| 赣C1155E | 2024-07-22 09:11:29 |
| 沪D75818 | 2024-07-22 07:41:07 |
| 沪DS8298 | 2024-07-22 19:26:47 |
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.