Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi all,
So I am a newbie to DAX and I would like to find out the number of cars that are inside the parking lot at an hourly rate based on user-type(daily & season). The sample data is below:
Your help wiil be highly appreciated.
Hi @aliasghar,
COUNT and COUNTROWS functions may help you.
In addition, here is a similar thread you could have a reference.
If you still need help, please share your data sample as table and your expected output.
Best Regards,
Cherry
Hi @v-piga-msft,
Thanks for the respond, However, the COUNTIF function doesn't give me the expected output. Basically what I'm trying to achieve is to find out the number of people utilizing the parking space based on user type (daily & season) at an hourly rate. The sample data as below:
| UserId | Date | Time | Terminal | Exit/Entry | Charges | User_Type |
| FD022450 | 6/3/2018 | 08:28:00 | 0D | Entry | 3.71 | Daily |
| FD022450 | 6/3/2018 | 15:41:00 | 0C | Exit | 3.71 | Daily |
| FD022450 | 7/3/2018 | 08:39:31 | 0D | Entry | 3.71 | Daily |
| FD022450 | 7/3/2018 | 12:30:42 | 0C | Exit | 4.77 | Daily |
| FD022450 | 8/3/2018 | 08:57:31 | 0D | Entry | 2.65 | Daily |
| FD022450 | 8/3/2018 | 10:35:00 | 0C | Exit | 2.65 | Daily |
| FD022450 | 8/3/2018 | 10:57:27 | 0D | Entry | 2.12 | Daily |
| FD022450 | 8/3/2018 | 17:00:17 | 0C | Exit | 2.12 | Daily |
| FD030715 | 8/3/2018 | 07:57:07 | 0D | Entry | 3.71 | Daily |
| FD030715 | 8/3/2018 | 10:27:39 | 0C | Exit | 3.71 | Daily |
| FD034848 | 25/3/2018 | 11:23:37 | 0D | Entry | 2.65 | Daily |
| FD034848 | 25/3/2018 | 12:54:44 | 0C | Exit | 2.65 | Daily |
| FD031881 | 3/3/2018 | 12:50:05 | 0D | Entry | Season | Season |
| FD031881 | 3/3/2018 | 14:20:00 | 0C | Exit | Season | Season |
| FD034690 | 27/3/2018 | 11:36:03 | 0D | Entry | Season | Season |
| FD034690 | 27/3/2018 | 15:30:22 | 0C | Exit | Season | Season |
| FD035133 | 13/3/2018 | 08:39:08 | 0D | Entry | Season | Season |
| FD035133 | 13/3/2018 | 11:47:03 | 0C | Exit | Season | Season |
| FD036751 | 13/3/2018 | 08:42:19 | 0D | Entry | Season | Season |
| FD036751 | 13/3/2018 | 14:11:05 | 0C | Exit | Season | Season |
| FD036751 | 14/3/2018 | 10:33:30 | 0D | Entry | Season | Season |
| FD036751 | 14/3/2018 | 12:33:41 | 0C | Exit | Season | Season |
| FD036751 | 15/3/2018 | 12:45:05 | 0D | Entry | Season | Season |
| FD036751 | 15/3/2018 | 17:20:33 | 0C | Exit | Season | Season |
| FD036751 | 16/3/2018 | 10:38:13 | 0D | Entry | Season | Season |
| FD036751 | 16/3/2018 | 12:38:59 | 0C | Exit | Season | Season |
| FD036751 | 19/3/2018 | 13:22:21 | 0D | Entry | Season | Season |
| FD036751 | 19/3/2018 | 17:58:56 | 0C | Exit | Season | Season |
| FD038112 | 14/3/2018 | 15:20:58 | 0D | Entry | Season | Season |
| FD038112 | 14/3/2018 | 18:02:08 | 0C | Exit | Season | Season |
| FD038112 | 16/3/2018 | 10:18:51 | 0D | Entry | Season | Season |
| FD038112 | 16/3/2018 | 12:49:52 | 0C | Exit | Season | Season |
| FD038112 | 16/3/2018 | 14:07:43 | 0D | Entry | Season | Season |
| FD038112 | 16/3/2018 | 17:00:40 | 0C | Exit | Season | Season |
| FD038112 | 19/3/2018 | 13:39:11 | 0D | Entry | Season | Season |
| FD038112 | 19/3/2018 | 20:36:58 | 0C | Exit | Season | Season |
Desired output:
| For everyday | No. Daily | No. Season | Total |
| 9 AM | 14 | 9 | 23 |
| 11 AM | 13 | 8 | 21 |
| 12 PM | 23 | 12 | 35 |
| 1 PM | 11 | 12 | 23 |
| 2 PM | 10 | 12 | 22 |
| 3 PM | 5 | 8 | 13 |
| 4 PM | 8 | 9 | 17 |
| 5 PM | 9 | 4 | 13 |
Or the desired output could also be in a form of a chart.
Best Regards,
Aliasghar.
Hi @aliasghar,
Thanks for your data sample and your desired output.
However, I'm not clear about the logic of your expected output, could you describe it in more details?
Do you have another time table? For your expected output, it seems that we need to create a calculated table.
Best Regards,
Cherry
Hi @v-piga-msft,
Thanks for the response. Basically for the desired output what I want to achieve is 2 things:
1) No of cars entering the parking. (it's solved, where I used the count function)
2) Based on the entry and exits of the cars from the parking lot(as seen from the sample data). I am trying to find out how many cars are utilizing the parking space at an hourly rate by day.
As for the timetable, I don't have one.
Regards,
Aliasghar
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 36 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 129 | |
| 88 | |
| 79 | |
| 68 | |
| 63 |