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
Hello Community,
In the following data set from a HISTORY TABLE, I have operations that are picking items from 8pm (200000) the previous day (yesterday) through 8am (80000) today.
I would like to create a Card that shows the QTY PICKED only in that dynamic timeframe. Any assistance would be most helpful! Thank you.
Solved! Go to Solution.
@MA_guy_VER Try:
Measure =
VAR __Today = TODAY()
VAR __Yesterday = __Today - 1
VAR __Table = FILTER('Table', ( [Date] = __Yesterday && [Time] >= 80000 ) || ( [Date] = __Today && [Time] <= 200000) )
RETURN
SUMX(__Table,[Qty Picked])
I think Greg got the hours reversed. Please re-try with this:
Measure =
VAR __Today = TODAY()
VAR __Yesterday = __Today - 1
VAR __Table = FILTER('Table', ( [Date] = __Yesterday && [Time] >= 200000 ) || ( [Date] = __Today && [Time] <= 80000) )
RETURN
SUMX(__Table,[Qty Picked])
Yes, we are assuming your [Date] Column is a Date Field. It looks to be more like a DateKey.
So, in this case we need to convert the VAR _Today into a similar DateKey:
VAR _Today = YEAR( Today() ) & MONTH( Today() ) & DAY( Today() )
VAR _Yesterday = _Today - 1
Ensure your Date Column above is numeric
@MA_guy_VER Try:
Measure =
VAR __Today = TODAY()
VAR __Yesterday = __Today - 1
VAR __Table = FILTER('Table', ( [Date] = __Yesterday && [Time] >= 80000 ) || ( [Date] = __Today && [Time] <= 200000) )
RETURN
SUMX(__Table,[Qty Picked])
I think Greg got the hours reversed. Please re-try with this:
Measure =
VAR __Today = TODAY()
VAR __Yesterday = __Today - 1
VAR __Table = FILTER('Table', ( [Date] = __Yesterday && [Time] >= 200000 ) || ( [Date] = __Today && [Time] <= 80000) )
RETURN
SUMX(__Table,[Qty Picked])
@Greg_Deckler , @rsbin Same result. Would it have anything to do with the format of the Today () mm/dd/yyyy hh:mm:ss am vs what is being written to the database 20220926?
Yes, we are assuming your [Date] Column is a Date Field. It looks to be more like a DateKey.
So, in this case we need to convert the VAR _Today into a similar DateKey:
VAR _Today = YEAR( Today() ) & MONTH( Today() ) & DAY( Today() )
VAR _Yesterday = _Today - 1
Ensure your Date Column above is numeric
@rsbin @Greg_Deckler of course it wouldn't be. Left is what is coming in from the data. Right is the snippet from your last post (I took 26 days off to see the formatting on DD. I had to add the zeros in to get it to match. The var will most likely need some formatting or IFs as the original drops the leading zeros in the MM and DD. Again, super appreciative of the assistance as I am still learning how to walk in PBi
Hi , @MA_guy_VER
You can use this dax to try to replace the date format:
Measure 1 = YEAR( Today() )*10000 + MONTH( Today() ) *100 + DAY( Today() ) & ".00"
The result is as follows:
If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
@v-yueyunzh-msft That worked after I removed the ".00" from the end. Cheers!
@rsbin , @Greg_Deckler did a quick measure for validation on date and it returned the results. When using Today() it blanks.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 41 | |
| 38 | |
| 36 | |
| 31 | |
| 28 |
| User | Count |
|---|---|
| 129 | |
| 88 | |
| 79 | |
| 68 | |
| 63 |