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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
reemadsouza
Frequent Visitor

add a calculated column

I want to add a calculated column in the below matrix, which will calculate, if row =202, then take value in row 201 and divde by value in row 75, it should dynamically calculate with changes to comapny , geo, or period and the month/years

reemadsouza_0-1744771043572.png

 

1 ACCEPTED SOLUTION
pankajnamekar25
Super User
Super User

Hello @reemadsouza 

 

try this DAX

NewColumn =

VAR CurrentMetric = 'Data'[MetricID]

VAR Company = 'Data'[Company]

VAR Geo = 'Data'[Geo]

VAR Period = 'Data'[Period]

 

VAR Value201 =

    CALCULATE (

        MAX ( 'Data'[Value] ),

        'Data'[MetricID] = 201,

        'Data'[Company] = Company,

        'Data'[Geo] = Geo,

        'Data'[Period] = Period

    )

 

VAR Value75 =

    CALCULATE (

        MAX ( 'Data'[Value] ),

        'Data'[MetricID] = 75,

        'Data'[Company] = Company,

        'Data'[Geo] = Geo,

        'Data'[Period] = Period

    )

 

RETURN

    IF (

        CurrentMetric = 202,

        DIVIDE ( Value201, Value75 )

    )

Thanks,
 Pankaj Namekar | LinkedIn

View solution in original post

1 REPLY 1
pankajnamekar25
Super User
Super User

Hello @reemadsouza 

 

try this DAX

NewColumn =

VAR CurrentMetric = 'Data'[MetricID]

VAR Company = 'Data'[Company]

VAR Geo = 'Data'[Geo]

VAR Period = 'Data'[Period]

 

VAR Value201 =

    CALCULATE (

        MAX ( 'Data'[Value] ),

        'Data'[MetricID] = 201,

        'Data'[Company] = Company,

        'Data'[Geo] = Geo,

        'Data'[Period] = Period

    )

 

VAR Value75 =

    CALCULATE (

        MAX ( 'Data'[Value] ),

        'Data'[MetricID] = 75,

        'Data'[Company] = Company,

        'Data'[Geo] = Geo,

        'Data'[Period] = Period

    )

 

RETURN

    IF (

        CurrentMetric = 202,

        DIVIDE ( Value201, Value75 )

    )

Thanks,
 Pankaj Namekar | LinkedIn

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors