Forum Discussion
Question to identify discrepancies
- 1 year ago
You've posted this in the Power Query section so here's a PQ offering:
If a date doesn't appear in the Date slicer, no-one's placed any orders.
re: "I want to see that customer 1 did not make an order etc etc"
If you're not bothered about the customer name then a direct pivot from the Orders table is possible; see pivot at cell H27.
The workbook: https://app.box.com/s/qqgqq8hwpfz8gickojhdhftsay70cdo1
You can achieve this in Power BI by creating a table that shows all customers and their order status for a selected date. Here’s how you can do it:
Step-by-Step Guide
Load Data:
Load both your customer list and order list into Power BI.
Create Relationships:
Ensure there is a relationship between the Customer ID in the customer list and the Customer ID in the order list.
Create a Date Slicer:
Add a slicer to your report and set it to filter by the order date.
Create a Calculated Table:
Use DAX to create a calculated table that combines the customer list with their order status for the selected date.
Example DAX Code
Customer List:
Customer ID | Customer Name | Address
1 | Bob |
2 | Lisa |
3 | Ted |
4 | John |
Order List:
Customer ID | Date | Product | Quantity
1 | 1/7/2024 | |
2 | 8/7/2024 | |
1 | 8/7/2024 | |
3 | 1/7/2024 | |
4 | 1/7/2024 | |
Create a Calculated Table:
Go to Modeling > New Table and enter the following DAX formula:
CustomerOrders =
ADDCOLUMNS(
'Customer List',
"Order Status",
IF(
COUNTROWS(
FILTER(
'Order List',
'Order List'[Customer ID] = 'Customer List'[Customer ID] &&
'Order List'[Date] = SELECTEDVALUE('Order List'[Date])
)
) > 0,
"Ordered",
"No Order"
)
)
Add the Table to Your Report:
Add the CustomerOrders table to your report and include the Customer ID, Customer Name, and Order Status columns.
Filter by Date:
Use the date slicer to filter the CustomerOrders table by the selected date.
This setup will allow you to filter by any date and see which customers have placed an order and which have not.
Best Regards
Saud Ansari
If this post helps, please Accept it as a Solution to help other members find it. I appreciate your Kudos!
Thank you - this is only giving me no order results. I am not getting and ordered?