Forum Discussion

Megha2498's avatar
Megha2498
Frequent Visitor
2 years ago
Solved

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%
  • Hi Megha2498,

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

    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

     

1 Reply

  • Hi Megha2498,

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

    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