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! Learn more
Hi all,
Can anyone help with this formula in Power BI DAX please.
The result I need is in precentage.
Thanks,
Solved! Go to Solution.
Hi @Ling_wen97 ,
Try formula like below:
M =
VAR cur =
MONTH ( MAX ( test[Date] ) )
VAR pre1 =
MONTH ( EOMONTH ( MAX ( test[Date] ), 0 ) )
VAR pre2 =
MONTH ( EOMONTH ( MAX ( test[Date] ), -2 ) )
VAR nex1 =
MONTH ( EOMONTH ( MAX ( test[Date] ), -3 ) )
VAR nex2 =
MONTH ( EOMONTH ( MAX ( test[Date] ), -5 ) )
VAR per =
CALCULATE (
SUM ( test[Order Qty] ),
FILTER ( ALL ( test ), cur <= pre1 && cur >= pre2 )
)
VAR nex =
CALCULATE (
SUM ( test[Order Qty] ),
FILTER ( ALL ( test ), cur <= nex1 && cur >= nex2 )
)
RETURN
DIVIDE ( per, nex )
If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Ling_wen97 ,
Try formula like below:
M =
VAR cur =
MONTH ( MAX ( test[Date] ) )
VAR pre1 =
MONTH ( EOMONTH ( MAX ( test[Date] ), 0 ) )
VAR pre2 =
MONTH ( EOMONTH ( MAX ( test[Date] ), -2 ) )
VAR nex1 =
MONTH ( EOMONTH ( MAX ( test[Date] ), -3 ) )
VAR nex2 =
MONTH ( EOMONTH ( MAX ( test[Date] ), -5 ) )
VAR per =
CALCULATE (
SUM ( test[Order Qty] ),
FILTER ( ALL ( test ), cur <= pre1 && cur >= pre2 )
)
VAR nex =
CALCULATE (
SUM ( test[Order Qty] ),
FILTER ( ALL ( test ), cur <= nex1 && cur >= nex2 )
)
RETURN
DIVIDE ( per, nex )
If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This will be the sameple data for example
Named table - Test
DAX depends on context/scenario heavily, you will get your solution faster if you could provide some sample data, ideally with named table and columns.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.