Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi Team, i need to some help on below dax based on slicer selection when we go for q2 i need to show previous quarter value, if i go Q3 need to display Q2 value. I tried based on my requirement on below formula but it's giving wrong result. can anyone correct my formula.
Result need to display like this
My Formula is
QTY Orderr-REQ-Fcst Selected Cycle_lookup =
VAR MINDATE =
CALCULATE(
MIN(Calender_Cycle_dt[Date]),
ALLSELECTED(Calender_Cycle_dt[Date])
)
VAR MNTHNO = MONTH(MINDATE)-3
VAR YRNO = YEAR(MINDATE)
VAR PREVIOUSDATE = DATE(YRNO,MNTHNO,01)
/*IF((MNTHNO) = -1,DATE((YRNO-1),12,DAY(MINDATE)),
DATE(YRNO,MNTHNO,DAY(MINDATE)))*/
///TYPE_1 CALC >> GET ALL MAF
VAR TYPE1 =
CALCULATE(
[p.forcast_summarize_data] ,
ALL(GlobalForecast_DQ[CYCLE_DT]),
FILTER(GlobalForecast_DQ,(GlobalForecast_DQ[PERIOD_DT]) >= PREVIOUSDATE &&
GlobalForecast_DQ[CYCLE_DT] = PREVIOUSDATE))
VAR TYPE3 =
CALCULATE(
Sum(GlobalForecast_DQ[REQ]),
ALL(GlobalForecast_DQ[CYCLE_DT]),
FILTER(GlobalForecast_DQ,(GlobalForecast_DQ[PERIOD_DT]) < PREVIOUSDATE &&
GlobalForecast_DQ[CYCLE_DT] = DATE(5999,01,01)
) )
/// >>FINAL RESULT BASED ON MONTH SELECTION
RETURN
TYPE1 + TYPE3
Solved! Go to Solution.
Hi @sreddy47652
Are you using a Calendar table in your model?
If so you can do the following by creatinga QTD mesure
Forecast QTD =
TOTALQTD(Sum(GlobalForecast_DQ[REQ), 'Calendar[Date])
Then you can use this measure to calculate the previous quarter
Forecast PQ =
CALCULATE( [Forecast QTD], DATEADD('Calendar'[Date], -1, QUARTER))
Hope this helps
Joe
Proud to be a Super User! | |
Date tables help! Learn more
Hi @sreddy47652
Are you using a Calendar table in your model?
If so you can do the following by creatinga QTD mesure
Forecast QTD =
TOTALQTD(Sum(GlobalForecast_DQ[REQ), 'Calendar[Date])
Then you can use this measure to calculate the previous quarter
Forecast PQ =
CALCULATE( [Forecast QTD], DATEADD('Calendar'[Date], -1, QUARTER))
Hope this helps
Joe
Proud to be a Super User! | |
Date tables help! Learn more
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 98 | |
| 72 | |
| 50 | |
| 48 | |
| 42 |