Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
gr84
Frequent Visitor

Dax filter previuos day

Hi, 

my purpose is filter in my dax query data relative only previuos day.

How can I filter without specify date?

 

    VAR __DS0FilterTable2 =
        FILTER(
            KEEPFILTERS(VALUES('AlertCallDrop'[TLC pulita_Time_Issue_agg])),
            AND(
                'AlertCallDrop'[TLC pulita_Time_Issue_agg] >= DATE(2024, 4, 22),
                'AlertCallDrop'[TLC pulita_Time_Issue_agg] < DATE(2024, 4, 23)
            )
        )
   
Thanks.
1 ACCEPTED SOLUTION
audreygerred
Super User
Super User

Hello! Ideally, you will have a star schema model and have a date dimension table (here is a link to a blog I wrote about this and it has a link to my favorite date table: http://powerbiwithme.com/2023/08/01/the-custom-date-table-edition/). Once you have your date table set up and joined (and marked as a date table), you can make your initial base measure whether it is a count or sum or whatever on some field of your fact table. Then you can can make a measure for the prior day: Measure PD = CALCULATE([Your Measure], DATEADD('DateTable'[Date],-1,DAY)). Then, if you have your report filtered to today, the PD measure will give you the results for yesterday. If you are filtered to April 20, it will give you April 19.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

3 REPLIES 3
audreygerred
Super User
Super User

Hello! Ideally, you will have a star schema model and have a date dimension table (here is a link to a blog I wrote about this and it has a link to my favorite date table: http://powerbiwithme.com/2023/08/01/the-custom-date-table-edition/). Once you have your date table set up and joined (and marked as a date table), you can make your initial base measure whether it is a count or sum or whatever on some field of your fact table. Then you can can make a measure for the prior day: Measure PD = CALCULATE([Your Measure], DATEADD('DateTable'[Date],-1,DAY)). Then, if you have your report filtered to today, the PD measure will give you the results for yesterday. If you are filtered to April 20, it will give you April 19.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





gr84
Frequent Visitor

Hi,

I've check that with this sintax the output of query is always the same and relative to the dates present in the query.

My purpose is query with an output reative measurement of last one day available.

 

Thank's

ryan_mayu
Super User
Super User

could you pls provide some sample data and expected output?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.