Forum Discussion
Singh_Yoshi
1 year agoHelper I
DAX Code not working
I have following table in BI. Item Cost 18" Alloy -23000 20" Alloy 31000 Air Bag 5000 Deatc 250 I want to subtract 18" Alloy cost(-23000) from 20" Alloy(31000) and remove...
- 1 year ago
Hi Singh_Yoshi
Please try this:
Measure1 = VAR _alloy = CALCULATE ( SUM ( SampleData[Cost] ), FILTER ( ALL ( SampleData[Item], SampleData[Cost] ), SampleData[Item] IN { "18"" Alloy", "20"" Alloy" } ) ) RETURN SWITCH ( TRUE (), SELECTEDVALUE ( SampleData[Item] ) = "18"" Alloy", BLANK (), SELECTEDVALUE ( SampleData[Item] ) = "20"" Alloy", _alloy, SUM ( SampleData[Cost] ) )
danextian
1 year agoSuper User
Hi Singh_Yoshi
Please try this:
Measure1 =
VAR _alloy =
CALCULATE (
SUM ( SampleData[Cost] ),
FILTER (
ALL ( SampleData[Item], SampleData[Cost] ),
SampleData[Item] IN { "18"" Alloy", "20"" Alloy" }
)
)
RETURN
SWITCH (
TRUE (),
SELECTEDVALUE ( SampleData[Item] ) = "18"" Alloy", BLANK (),
SELECTEDVALUE ( SampleData[Item] ) = "20"" Alloy", _alloy,
SUM ( SampleData[Cost] )
)
Singh_Yoshi
1 year agoHelper I
I have a following table called Table1,
| Model Code | MSRP | LC |
| FJ11 | 1392000 | |
| FJ16 | 1580000 | 188000 |
| FJ7 | 1762000 | 182000 |
| FJ8 | 1912000 | 150000 |
| FJ15 | 1937000 | 25000 |
| FJ12 | 2279000 | 342000 |
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