Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi Power BI Community,
I need assistance with adjusting my DAX formulas to dynamically handle date ranges for both budget and actual revenue data.
1) I have two values Budget Revenue and Actual Revenue.
2) Budget Revenue is available from March 2023 to March 2025.
3) Actual Revenue is available from March 2023 to Jun 2024.
Current DAX Formulas
1) Last 3m actual_Revenue =
VAR referenceDate =
MAX('Calendar_table'[Date])
VAR previousDate =
DATESINPERIOD('Refrence Table'[Date], referenceDate, -3, MONTH)
VAR Result =
CALCULATE(
[Actual_Revenue],
REMOVEFILTERS('Calendar_table'),
KEEPFILTERS(previousDate),
USERELATIONSHIP('Calendar_table'[Date], 'Refrence Table'[Date])
)
RETURN
Result
2) Last 3m Budget Revenue =
VAR referenceDate =
MAX('Calendar_table'[Date])
VAR previousDate =
DATESINPERIOD('Refrence Table'[Date], referenceDate, -3, MONTH)
VAR Result =
CALCULATE(
[Budget_Revenue],
REMOVEFILTERS('Calendar_table'),
KEEPFILTERS(previousDate),
USERELATIONSHIP('Calendar_table'[Date], 'Refrence Table'[Date])
)
RETURN
Result
Requirement:-
1. When a month is selected in the slicer:
- The formulas should display the last 3 months from the selected date.
2. When no month is selected:
- The formulas should use the maximum available date of the Actual Revenue (e.g., June 2024) and display the last 3 months from that date.
Issues:
The formulas work correctly when a month is selected in the slicer, but they do not adjust dynamically to handle scenarios where actual revenue data is not available for future months.
Help Needed:
I need guidance on how to modify these formulas to meet the above requirements. Specifically, how can I adjust them so that:
- If no date is selected, the calculation considers the maximum date of the actual revenue data.
- If a date is selected, it calculates the last 3 months based on the selected date.
Thank you in advance for your help!
@amitchandak @Greg_Deckler @mickey64 @Ritaf1983 @rajendraongole1 @bhanu_gautam @SamWiseOwl @Ashish_Mathur @NaveenGandhi @Joe_Barry
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information or anything not related to the issue or question.
If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 37 | |
| 35 | |
| 34 | |
| 27 |
| User | Count |
|---|---|
| 137 | |
| 97 | |
| 74 | |
| 66 | |
| 65 |