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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Megha2498
Frequent Visitor

Power BI DAX

Hi

I need a DAX to calculate the variance % for etime data.

 

I am trying to using some date related DAX but it is not helping me.

The variance I am trying to get is

(# of open tickets in previous month - # of open tickets in reporting month) / # of open tickets in previous month

 

Start of the reporting month is 28 -Feb- 2023

sample data is below:

 

MonthOpen Requests (Reporting Month)Open Request (Previous Month)Variance%
Feb-2310206  
Mar-2310062102061.41%
Apr-231133610062-12.66%
May-231721511336-51.86%
Jun-231739017215-1.02%
Jul-232090317390-20.20%
Aug-2320692209031.01%
Sep-232314020692-11.83%
Oct-232476423140-7.02%
Nov-2323598247644.71%
Dec-2322180235986.01%
Jan-242256622180-1.74%
Feb-242431822566-7.76%
Mar-24218832431810.01%
Apr-242290621883-4.67%
May-24185422290619.05%
Jun-242458918542-32.61%
1 ACCEPTED SOLUTION
barritown
Super User
Super User

Hi @Megha2498,

You can create a calculated column below and adjust the output format to percentage:

barritown_0-1718308814927.png

In plain text:

calc_column_solution = 
VAR curMonthValue = [Open Requests (Reporting Month)]
VAR curMonth = [Month]
VAR prevMonth = MAXX ( FILTER ( tbl_with_data, [Month] < curMonth ), [Month] )
VAR prevMonthValue = MINX ( FILTER ( tbl_with_data, [Month] = prevMonth ), [Open Requests (Reporting Month)] )
RETURN DIVIDE ( prevMonthValue - curMonthValue, prevMonthValue )

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

 

View solution in original post

1 REPLY 1
barritown
Super User
Super User

Hi @Megha2498,

You can create a calculated column below and adjust the output format to percentage:

barritown_0-1718308814927.png

In plain text:

calc_column_solution = 
VAR curMonthValue = [Open Requests (Reporting Month)]
VAR curMonth = [Month]
VAR prevMonth = MAXX ( FILTER ( tbl_with_data, [Month] < curMonth ), [Month] )
VAR prevMonthValue = MINX ( FILTER ( tbl_with_data, [Month] = prevMonth ), [Open Requests (Reporting Month)] )
RETURN DIVIDE ( prevMonthValue - curMonthValue, prevMonthValue )

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.