Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hello Experts,
Below is the sample table for copying:
| Channel | Company | Category | Brand | Rank | Value |
| Channel1 | Company1 | Cat1 | Brand1 | 2 | 100 |
| Channel1 | Company2 | Cat1 | Brand2 | 1 | 50 |
| Channel2 | Company1 | Cat1 | Brand1 | 2 | 200 |
| Channel2 | Company2 | Cat1 | Brand2 | 1 | 300 |
Image Representation:
Requirement: Calculate the Difference column/measure. Basically it is Company1 Value - Company2 Value for the same Channel.
Solved! Go to Solution.
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")))
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]
)
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 !!! |
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]
)
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 !!! |
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")))
@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])
@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])
)
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 44 | |
| 43 | |
| 38 | |
| 19 | |
| 15 |
| User | Count |
|---|---|
| 68 | |
| 64 | |
| 31 | |
| 29 | |
| 24 |