Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I need one day data from yesterday 11pm to today 11pm. i need to add this filter in front end. how can I make this happened in front end as a filter.
Sales Date (Column name)
11-11-2021 11:50:40 PM
12-11-2021 10:30:00 PM
14-11-2021 10:10:40 PM
15-11-2021 10:40:40 PM
Hello,
Thank you for elaborating in detail to your use case scenario. With a combination of Variable input object and a Button object, I was able to implement something similar to what you need. You can take the logic behind the implementation and modify the expressions based on your needs. There could be other potential solutions to your use case scenario, however this is the only one that I was able to implement, that can get you as close as possible to your desired outcome. These are the steps that I have followed:
='>=$(=Date(Date#('$(varSelectedDate)','D-M-YYYY h:mm:ss[.fff] TT')-1,'D-M-YYYY h:mm:ss[.fff] TT'))<=$(=Date(Date#('$(varSelectedDate)','D-M-YYYY h:mm:ss[.fff] TT'),'D-M-YYYY h:mm:ss[.fff] TT'))'
Allow me to break down the expression:
Demonstration:
This might not be the exact solution that you were looking for. However, as mentioned above, you can take the logic of how it works and modify it according to your needs. You can use the function Today() to get the current date and then subtract 24 hours or if you would like to make the Variable Input more reliable, so the user won't have to worry about specifying the exact value with the exact format, you can create multiple Variable Input objects with dropdown option to select Year, Month, Day separately and then construct the entire string in the expression.
I hope that this information was helpful!
Hello,
The use case scenario that you have described is not very clear at the moment. You have mentioned "filter" which means that you would like to filter the data in the dataset, but it is done after the data is already fetch from the source. However, in the title you have mentioned that you would like to "fetch" the data for the last 24 hours, which is an action that you can only do from the Data load editor or from the Data manager.
I have prepared for you a couple of various options that cover most of the specified use case scenarios and the dataset that I use is:
1. If you are interested in having a button that will create a filter based on the 24 hour timeframe that you have specified, then you can follow the approach:
This is the result that you get when the button is clicked:
2. If you would like to count the data based on the 24 our timeframe, then you can use a set analysis in your measure:
For example you can create a KPI chart with the expression Count( {<[Sales Date]={">=11/11/2021 11:50:00 PM<=11/12/2021 11:50:00 PM"}>} Value).
This expression counts the data Value only where the Sales Date is within the specified 24 hour timeframe. Again you can modify this expression as needed to cover a more complicated use case scenario.
3. Another use case scenario, is to "fetch" the data based on the 24 hour timeframe that you have specified:
For example you can use the following scrip in Data load editor:
LOAD
"Sales Date",
Value
FROM [lib://Folder/dataset.xlsx]
(ooxml, embedded labels, table is Sheet1)
WHERE "Sales Date" >= '11/11/2021 11:50:00 PM' and "Sales Date" <= '11/12/2021 11:50:00 PM';
This script will only "fetch" the data from the source that is within the specified 24 hour timeframe.
I hope that this information was helpful. In case the issue was resolved, please mark the answer as solution to give it more visibility for other community members. Otherwise, if none of the points above have helped you resolve the issue, please elaborate in detail to which exactly is the use case scenario that you are trying to achieve. A screenshot of the issue will be helpful and you can also share with us, what you have already tried!
Thank you soo much for your reply...
I Have data as
I need a filter in front end like which i select i need to see the data last 24hrs from yesterday 11pm to today 11pm. when ever i select this filter it should show yesterday's 11pm onwards today 11pm only.
If today date and time is 15-11-2021 11:30:20pm, If I select that filter it should show below data.
Hello,
Thank you for elaborating in detail to your use case scenario. With a combination of Variable input object and a Button object, I was able to implement something similar to what you need. You can take the logic behind the implementation and modify the expressions based on your needs. There could be other potential solutions to your use case scenario, however this is the only one that I was able to implement, that can get you as close as possible to your desired outcome. These are the steps that I have followed:
='>=$(=Date(Date#('$(varSelectedDate)','D-M-YYYY h:mm:ss[.fff] TT')-1,'D-M-YYYY h:mm:ss[.fff] TT'))<=$(=Date(Date#('$(varSelectedDate)','D-M-YYYY h:mm:ss[.fff] TT'),'D-M-YYYY h:mm:ss[.fff] TT'))'
Allow me to break down the expression:
Demonstration:
This might not be the exact solution that you were looking for. However, as mentioned above, you can take the logic of how it works and modify it according to your needs. You can use the function Today() to get the current date and then subtract 24 hours or if you would like to make the Variable Input more reliable, so the user won't have to worry about specifying the exact value with the exact format, you can create multiple Variable Input objects with dropdown option to select Year, Month, Day separately and then construct the entire string in the expression.
I hope that this information was helpful!