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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
bedata1
Frequent Visitor

Multiple Time Variables with If Return

Hi Community,

 

I want to create a DAX formula that shows the following:

If Date <= Today, then show the "amount" from the "G/L Entry" table and if Date > Today, then show the "amount" from the "Budget" table.

 

Date is linked to postingdate from the "G/L Entry" & "Budget" tables.

 

Visualization: Matrix with Month column

 

Folgende DAX habe ich erstellt, jedoch funktioniert diese nicht richtig:

IS LE = 
var TodayDate =
    TODAY()
var ActualAmount = 
    CALCULATE(SUM('G/L Entry'[amount]), FILTER('Date','Date'[Date] <= TODAY()))
var BudgetAmount =
    CALCULATE(SUM(Budget[Amount]),FILTER('Date','Date'[Date] > TODAY()))
return
IF(FILTER(Budget,Budget[Date] > TodayDate),BudgetAmount,ActualAmount)
 
Can anybody help me with creating this DAX formula?
 
Thank you for your help.

 

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @bedata1 

 

try like:

IS LE = 
var TodayDate = TODAY()
var ActualAmount = 
CALCULATE(
    SUM('G/L Entry'[amount]),     FILTER('Date','Date'[Date] <= TODAY())
)
var BudgetAmount =    
CALCULATE(
    SUM(Budget[Amount]),
    FILTER('Date','Date'[Date] > TODAY())
)
return
IF(
    MAX(Budget[Date]) > TodayDate,
    BudgetAmount,
    ActualAmount
)

View solution in original post

2 REPLIES 2
bedata1
Frequent Visitor

@FreemanZ Thank you for your awsome help, the DAX formula is working!

FreemanZ
Super User
Super User

hi @bedata1 

 

try like:

IS LE = 
var TodayDate = TODAY()
var ActualAmount = 
CALCULATE(
    SUM('G/L Entry'[amount]),     FILTER('Date','Date'[Date] <= TODAY())
)
var BudgetAmount =    
CALCULATE(
    SUM(Budget[Amount]),
    FILTER('Date','Date'[Date] > TODAY())
)
return
IF(
    MAX(Budget[Date]) > TodayDate,
    BudgetAmount,
    ActualAmount
)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.