The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I have a table that is pulling data from an excel work book. This table is then appended to combine with a table that is coming from a SQL query. I am trying to filter the dates on the excel table to match the results from the SQL query.
The excel data looks like this:
Date | Machine | Time | Job |
4/9/2022 | Alpha | 4 | 1098 |
8/23/2022 | Beta | 3.5 | 1702 |
8/23/2022 | Beta | 2 | 1701 |
9/30/2022 | Delta | 4.5 | 1104 |
10/01/2022 | Alpha | 3 | 1093 |
Right now I have this DAX:
SUMMARIZEMachine =
CALCULATETABLE(
SUMMARIZE(
'MachineRunTime'
,MachineRunTime[Date]
,MachineRunTime[Machine]
,MachineRunTime[Time]
,MachineRunTime[Job]
)
,FILTER(ALL(
MachineRunTime
), FORMAT(MachineRunTime[Date], "Short Date") >= FORMAT(DATEADD(MachineRunTime[Today], -84, DAY), "Short Date"))
)
That creates a table for me, but it doesn't acutally filter the Date column and it shows all the data. How can I fix this so the Date column is filtered correctly? Note that I created a "Today" column in the original table within Power BI so I could use the DATEADD() function.
Solved! Go to Solution.
I realized that I don't need the DATEADD function to get the results I need. Coming from a SQL background, I mistakenly thought that might be needed.
Solution was as follows:
SUMMARIZEMachine =
CALCULATETABLE(
SUMMARIZE(
'MachineRunTime'
,MachineRunTime[Date]
,MachineRunTime[Machine]
,MachineRunTime[Time]
,MachineRunTime[Job]
)
,FILTER(
ALL(SecureMachineRunTime)
,MachineRunTime[Date] >= TODAY() - 42
)
)
I realized that I don't need the DATEADD function to get the results I need. Coming from a SQL background, I mistakenly thought that might be needed.
Solution was as follows:
SUMMARIZEMachine =
CALCULATETABLE(
SUMMARIZE(
'MachineRunTime'
,MachineRunTime[Date]
,MachineRunTime[Machine]
,MachineRunTime[Time]
,MachineRunTime[Job]
)
,FILTER(
ALL(SecureMachineRunTime)
,MachineRunTime[Date] >= TODAY() - 42
)
)
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
79 | |
77 | |
46 | |
39 |
User | Count |
---|---|
143 | |
113 | |
64 | |
63 | |
53 |