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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Need help creating a Delta column based on varying columns

I am trying to create a matrix/data table.


The Rows -  the rows are metric names for my KPI funnel. The names are defined within a custom MetricName datatable. ("Impressions", "Clicks", "CTR"....etc.)

 

The columns - Fiscal Years that the user can select using a multiselect filter (the user should select only two of these)

 

The values - uses the SELECTEDVALUE and SWITCH functionalities to display the values for each KPI in the MetricName datatable, like so:


Values =
VAR CurrentMetric = SELECTEDVALUE(Metrics[MetricName])
RETURN
SWITCH(
    CurrentMetric,
    "Impressions", CALCULATE(SUM('FLOWERS_KPI_F'[IMPRESSIONS])),
    "Clicks", CALCULATE(SUM('FLOWERS_KPI_F'[CLICKS])),
    "CTR", DIVIDE(
        CALCULATE(SUM('FLOWERS_KPI_F'[CLICKS])),
        CALCULATE(SUM('FLOWERS_KPI_F'[IMPRESSIONS]))
    ),.......
 
 Below is the current table. I need to add a third delta column that calculates the delta between the two columns. The columns selected don't have to be adjacent. For example, the user should be able view the delta between 2019 to 2022. I also will be doing this at the fiscal week or fiscal day level - so I would prefer if theres a flexible way to implement this delta.
BadDashboarder_0-1729215493181.png

 

 
 

 

3 REPLIES 3
Anonymous
Not applicable

I had something similar, but the column filter context made me return all zeroes for delta, so I used ALLSELECTED() to ignore the column fitler context:

YoY% Change = 
VAR AllYears = CALCULATETABLE(VALUES('AT_SEM_FISCAL_CALENDAR'[FY_N]), ALLSELECTED())
VAR MinYear = MINX(AllYears, 'AT_SEM_FISCAL_CALENDAR'[FY_N])
VAR MaxYear = MAXX(AllYears, 'AT_SEM_FISCAL_CALENDAR'[FY_N])


VAR Values_Year1 = 
CALCULATE(
    [Values],
    'AT_SEM_FISCAL_CALENDAR'[FY_N] = MinYear
)

VAR Values_Year2 = 
CALCULATE(
    [Values],
    'AT_SEM_FISCAL_CALENDAR'[FY_N] = MaxYear
)

RETURN 
IF(
    Values_Year1 <> 0,
    (Values_Year2 - Values_Year1) / Values_Year1,
    BLANK())

 The only issue now is im getting duplicate delta columns, presumable because there's a %YoY change/Delta for each fiscal year column. How do i remove the first one?

BadDashboarder_1-1729270142656.png

@Kedar_Pande 

Anonymous
Not applicable

Hi @Anonymous ,

 

According to your statement, I think you can try to DIY "Column Subtotal" in visual format.

Firstly, change the Subtotal label as "YoY% Change".

vrzhoumsft_0-1730189807121.png

Then create a new measure based on [Values] measure.

Measure = 
VAR AllYears = CALCULATETABLE(VALUES('AT_SEM_FISCAL_CALENDAR'[FY_N]), ALLSELECTED())
VAR MinYear = MINX(AllYears, 'AT_SEM_FISCAL_CALENDAR'[FY_N])
VAR MaxYear = MAXX(AllYears, 'AT_SEM_FISCAL_CALENDAR'[FY_N])


VAR Values_Year1 = 
CALCULATE(
    [Values],
    'AT_SEM_FISCAL_CALENDAR'[FY_N] = MinYear
)

VAR Values_Year2 = 
CALCULATE(
    [Values],
    'AT_SEM_FISCAL_CALENDAR'[FY_N] = MaxYear
)
RETURN
IF(HASONEVALUE(AT_SEM_FISCAL_CALENDAR[FY_N]),[Values],(Values_Year2 - Values_Year1) / Values_Year1)

Use this measure in matrix value field. Then we need to create a measure for dynamic data format.

vrzhoumsft_1-1730189936922.png

IF(HASONEVALUE(AT_SEM_FISCAL_CALENDAR[FY_N]),"0.00","0.00%")

Result is as below.

vrzhoumsft_2-1730189981330.png

You can download my sample file to learn more details.

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Kedar_Pande
Super User
Super User

@Anonymous 

Create a Delta Measure:

Delta =
VAR SelectedYears = VALUES(YourYearTable[Year]) // Replace with your actual year table
VAR Year1 = SELECTEDVALUE(SelectedYears, 0, 1) // Get the first selected year
VAR Year2 = SELECTEDVALUE(SelectedYears, 1, 0) // Get the second selected year

RETURN
IF(
Year1 <> 0 && Year2 <> 0,
[Values for Year2] - [Values for Year1], // Replace with your measure for each selected year
BLANK()
)

Adjust your existing values measure

Values_Year1 =
CALCULATE(
[Values],
FILTER(
'YourYearTable',
'YourYearTable'[Year] = SELECTEDVALUE(YourYearTable[Year], 0)
)
)
Values_Year2 = 
CALCULATE(
[Values],
FILTER(
'YourYearTable',
'YourYearTable'[Year] = SELECTEDVALUE(YourYearTable[Year], 1)
)
)

💌If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.