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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
atult
Advocate I
Advocate I

Need a Calculated Measure/Column

Hello Experts,
Below is the sample table for copying:

ChannelCompanyCategoryBrandRankValue
Channel1Company1Cat1Brand12100
Channel1Company2Cat1Brand2150
Channel2Company1Cat1Brand12200
Channel2Company2Cat1Brand21300

 

Image Representation:
SampleData.PNG

Requirement: Calculate the Difference column/measure. Basically it is Company1 Value - Company2 Value for the same Channel.

2 ACCEPTED SOLUTIONS
Ashish_Mathur
Super User
Super User

Hi,

This calculated column formula works

Column = if(Data[Company]="Company2",BLANK(),Data[Value]-CALCULATE(SUM(Data[Value]),FILTER(Data,Data[Channel]=EARLIER(Data[Channel])&&Data[Company]="Company2")))

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Anand24
Super User
Super User

Hi @atult ,
Try the below calculated measure:

New Measure = 
MAXX(
    FILTER(
        ALL('Table'), 
        'Table'[COMPANY] <> "Company1" && 'Table'[Channel] in VALUES('Table'[Channel])
        ) , 
        'Table'[Value]
) 
- 
MAXX(
    FILTER(
        'Table', 
        'Table'[COMPANY] = "Company1" && 'Table'[Channel] in VALUES('Table'[Channel])
    ), 
    'Table'[Value]
)

 

PBI_SuperUser_Rank@1x.png  

Give a Thumbs Up if this post helped you in any way and Mark This Post as Solution if it solved your query !!!

Proud To Be a Super User !!!
LinkedIn

View solution in original post

6 REPLIES 6
Anand24
Super User
Super User

Hi @atult ,
Try the below calculated measure:

New Measure = 
MAXX(
    FILTER(
        ALL('Table'), 
        'Table'[COMPANY] <> "Company1" && 'Table'[Channel] in VALUES('Table'[Channel])
        ) , 
        'Table'[Value]
) 
- 
MAXX(
    FILTER(
        'Table', 
        'Table'[COMPANY] = "Company1" && 'Table'[Channel] in VALUES('Table'[Channel])
    ), 
    'Table'[Value]
)

 

PBI_SuperUser_Rank@1x.png  

Give a Thumbs Up if this post helped you in any way and Mark This Post as Solution if it solved your query !!!

Proud To Be a Super User !!!
LinkedIn

Ashish_Mathur
Super User
Super User

Hi,

This calculated column formula works

Column = if(Data[Company]="Company2",BLANK(),Data[Value]-CALCULATE(SUM(Data[Value]),FILTER(Data,Data[Channel]=EARLIER(Data[Channel])&&Data[Company]="Company2")))

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
atult
Advocate I
Advocate I

@amitchandak@Greg_Deckler , @parry2k , @Ashish_Mathur 
Can you please look at this urgent requirement and help me?

@atult Try:

Column = 
  VAR __Channel = [Channel]
  VAR __Company = [Company]
  VAR __Category = [Category]
RETURN
  IF(
    __Company = "Company2",
    BLANK(),
    [Value] - MAXX(FILTER('Table',[Channel]=__Channel && __Company = "Company2" && __Category = [Category]),[Value])


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler,
Thanks for the reply !
But this is giving me the exact same value in the new column.

@atult Sorry, slight syntax error:

Column = 
  VAR __Channel = [Channel]
  VAR __Company = [Company]
  VAR __Category = [Category]
RETURN
  IF(
    __Company = "Company2",
    BLANK(),
    [Value] - MAXX(FILTER('Table',[Channel]=__Channel && [Company]="Company2" && [Category]=__Category),[Value])
  )


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.