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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Singh_Yoshi
Helper I
Helper I

Help with DAX

Hi All,

 

I have a following table called Table1,

Model CodeMSRPLC
FJ111392000 
FJ161580000188000
FJ71762000182000
FJ81912000150000
FJ15193700025000
FJ122279000342000

 

I have few measures as below names and consists of Items and Cost

  • FJ11-16 - Sum of the measure is (-1674)
  • FJ16-7 - Sum of the measure is (70650)
  • FJ7-8 - Sum of the measure is (176150)
  • FJ8-15 - Sum of the measure is (-68150)
  • FJ15-12 - Sum of the measure is (28500)

1. Now I want to subtract LC cost - SUM of each measure

2. I need the percentage of (LC Cost - SUM of each measure)

 

Kindly help me with DAX code

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @Singh_Yoshi 

 

I simply modeled a portion of the data and hope it fits your situation.

Pre MSRP = CALCULATE(MAX('Table'[MSRP]),FILTER(ALL('Table'),[MSRP]<SELECTEDVALUE('Table'[MSRP])))
LC = IF([Pre MSRP]=BLANK(),BLANK(),SUM('Table'[MSRP])-[Pre MSRP])
Sum Measure = SWITCH(TRUE(),
SELECTEDVALUE('Table'[Model Code])="FJ11",BLANK(),
SELECTEDVALUE('Table'[Model Code])="FJ16",[FJ11-16],
SELECTEDVALUE('Table'[Model Code])="FJ7",[FJ16-7],
SELECTEDVALUE('Table'[Model Code])="FJ8",[FJ7-8],
SELECTEDVALUE('Table'[Model Code])="FJ15",[FJ8-15],
SELECTEDVALUE('Table'[Model Code])="FJ12",[FJ15-12])
Result1 = [LC]-[Sum Measure]
Result2 = DIVIDE(SUM('Table'[MSRP]),[Pre MSRP]+[Sum Measure]*100)

vzhangtinmsft_0-1735890971096.png

Is this the result you expected?

 

Best Regards,

Community Support Team _Charlotte

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

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi, @Singh_Yoshi 

 

Have you solved your problem? If not resolved, can you provide more example data and your desired output? This will better describe your problem. How to provide sample data in the Power BI Forum - Microsoft Fabric Community

 

Best Regards,

Community Support Team _Charlotte

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

Hi,

This is one table called Table1,

Model CodeMSRP
FJ111392000
FJ161580000
FJ71762000
FJ81912000
FJ151937000
FJ122279000

 

I have one measure in my dashboard as below,

Singh_Yoshi_0-1735799226075.png


Now I want DAX for,
1. (MSRP of FJ16) / ((MSRP of FJ11 + Contents) * 100 
2. (MSRP of FJ7) / ((MSRP of FJ16 + Contents) * 100
and so on...

please provide me DAX

Anonymous
Not applicable

Hi, @Singh_Yoshi 

 

I simply modeled a portion of the data and hope it fits your situation.

Pre MSRP = CALCULATE(MAX('Table'[MSRP]),FILTER(ALL('Table'),[MSRP]<SELECTEDVALUE('Table'[MSRP])))
LC = IF([Pre MSRP]=BLANK(),BLANK(),SUM('Table'[MSRP])-[Pre MSRP])
Sum Measure = SWITCH(TRUE(),
SELECTEDVALUE('Table'[Model Code])="FJ11",BLANK(),
SELECTEDVALUE('Table'[Model Code])="FJ16",[FJ11-16],
SELECTEDVALUE('Table'[Model Code])="FJ7",[FJ16-7],
SELECTEDVALUE('Table'[Model Code])="FJ8",[FJ7-8],
SELECTEDVALUE('Table'[Model Code])="FJ15",[FJ8-15],
SELECTEDVALUE('Table'[Model Code])="FJ12",[FJ15-12])
Result1 = [LC]-[Sum Measure]
Result2 = DIVIDE(SUM('Table'[MSRP]),[Pre MSRP]+[Sum Measure]*100)

vzhangtinmsft_0-1735890971096.png

Is this the result you expected?

 

Best Regards,

Community Support Team _Charlotte

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

@Anonymous     Everything is perfect. This is almost what I expected. But the Please modify Result2 formula alone as below.

MSRP of FJ16 / SUM(MSRP of FJ11 + Sum Measure)

eg: 1580000/(1392000+(-1674)) = 1.1%

manvishah17
Solution Supplier
Solution Supplier

Hi @Singh_Yoshi ,

Subtracted Value = 
SWITCH(
    TRUE(),
    SELECTEDVALUE(Table1[Model Code]) = "FJ11-16", Table1[LC] - [FJ11-16],
    SELECTEDVALUE(Table1[Model Code]) = "FJ16-7", Table1[LC] - [FJ16-7],
    SELECTEDVALUE(Table1[Model Code]) = "FJ7-8", Table1[LC] - [FJ7-8],
    SELECTEDVALUE(Table1[Model Code]) = "FJ8-15", Table1[LC] - [FJ8-15],
    SELECTEDVALUE(Table1[Model Code]) = "FJ15-12", Table1[LC] - [FJ15-12],
    BLANK()
)
Percentage = 
DIVIDE(
    [Subtracted Value],
    Table1[LC],
    0
) * 100

 

Kedar_Pande
Super User
Super User

@Singh_Yoshi 

Difference = 
VAR MeasureSum = SWITCH(
TRUE(),
[Model Code] = "FJ11-16", -1674,
[Model Code] = "FJ16-7", 70650,
[Model Code] = "FJ7-8", 176150,
[Model Code] = "FJ8-15", -68150,
[Model Code] = "FJ15-12", 28500
)
RETURN
[LC] - MeasureSum
Percentage = 
DIVIDE([Difference], [LC], 0)

 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.