Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hi,
I hope someone can help be with the following issue:
I have a table with Order ID, Ordre date and Delivery date. I would like to count how many orders in a given period are also delivered in same periode. Eg. if I choose jan-feb 2018, I want to know how many orders have both order date and delivery date in this period.
I have a date table which is connected to the order date - and I know how to used date table and date slicers 🙂
Tove
Solved! Go to Solution.
Hi Tove,
One way of doing this is to use TREATAS to apply the Date filter to the Delivery date column as well.
Assuming your tables are called Orders and Date, the measure would look like this:
Orders Delivered in Same Period = CALCULATE ( DISTINCTCOUNT ( Orders[Order ID] ), KEEPFILTERS ( TREATAS ( VALUES ( 'Date'[Date] ), Orders[Delivery date] ) ) )
I assumed you wanted DISTINCTCOUNT of Order ID, but change as needed.
KEEPFILTERS is also there as a safeguard in case you are filtering on Delivery date, to ensure we stay within the current Delivery date filter context.
Out of interest - good article on TREATAS here.
Regards,
Owen
Hi Tove,
One way of doing this is to use TREATAS to apply the Date filter to the Delivery date column as well.
Assuming your tables are called Orders and Date, the measure would look like this:
Orders Delivered in Same Period = CALCULATE ( DISTINCTCOUNT ( Orders[Order ID] ), KEEPFILTERS ( TREATAS ( VALUES ( 'Date'[Date] ), Orders[Delivery date] ) ) )
I assumed you wanted DISTINCTCOUNT of Order ID, but change as needed.
KEEPFILTERS is also there as a safeguard in case you are filtering on Delivery date, to ensure we stay within the current Delivery date filter context.
Out of interest - good article on TREATAS here.
Regards,
Owen
Thank you very much - it works and I have learn two new DAX formulas 🙂
Tove
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
User | Count |
---|---|
120 | |
74 | |
72 | |
58 | |
49 |
User | Count |
---|---|
167 | |
83 | |
68 | |
66 | |
55 |