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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Question regarding DAX Patterns -

Hello Community  -  I am utilizing the DAX patterns formulas at this link.    Their example follows a specific column (order date).   

 

However, I have three such dates I would like to create time intelligence formulas for.   Order Date is one of them, but also Ship Date, and Due Date.   Due Date comes from the Orders table (just as Order Date does).     Ship Date comes from our Shipping Table.    Of course I will need to connect these to my date table, which I have done already.  

 

But my question is really around this formula below.   This formula is specifically for the Order Date, but I need this same formula applied to all three date fields.   I was hoping not to have to create three seperate  measures.   Is there a way to combine those three date fields into this formula?    For example, if I want to create a YTD measure for Orders (based on Order Date, and another measure for shipments YTD (based on ship date), I'd like to just be able to reference the same "showvaluefordates" measure in both YTD formulas.   Possible, or do I need to create, and reference, three distinct measures for each scenario? 

 

Standard time-related calculations – DAX Patterns

 

ShowValueForDates :=
VAR LastDateWithData =
    CALCULATE (
        MAX ( 'Sales'[Order Date] ),
        REMOVEFILTERS ()
    )
VAR FirstDateVisible =
    MIN ( 'Date'[Date] )
VAR Result =
    FirstDateVisible <= LastDateWithData
RETURN
    Result
1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@Anonymous,

 

You can create a calculation group to switch between dates:

 

https://www.sqlbi.com/articles/using-calculation-groups-to-switch-between-dates/ 





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

Proud to be a Super User!




View solution in original post

1 REPLY 1
DataInsights
Super User
Super User

@Anonymous,

 

You can create a calculation group to switch between dates:

 

https://www.sqlbi.com/articles/using-calculation-groups-to-switch-between-dates/ 





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

Proud to be a Super User!




Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.