Forum Discussion
Help with DAX
Hi i'm trying to create a point calculation with this formula:
1. Total Point = Distinct Count of Style#-Season * Base Point * Complexity
2. Complexity = 2 when Style Merch = B1 or O1, or when Model_Construction = S1 or S2 or S3, otherwise it's factor 1 ( no change)
3. If Marketing Type = P, add 3 points to Base Point, otherwise add 0 (no change)
I have a table like below:
| Style# | Season | Style#-Season | Fit | Line | Style_Merch | Model_Construction | Marketing Type | Base Point |
| ABC101 | Spring 23 | ABC101-Spring23 | Western | R1 | B1 | S1 | P | 5 |
| ABC102 | Summer 23 | ABC102-Summer23 | Asian | R2 | O1 | S2 | not P | 4 |
| ABC102 | Fall 23 | ABC102-Fall23 | Global | R3 | Not B1 or O1 | S3 | not P | 3 |
| ABC103 | Holiday 23 | ABC103-Holiday23 | Plus | R4 | Not B1 or O1 | Not S1 or S2 or S3 | P | 2 |
| ABC103 | Spring 23 | ABC103-Spring23 | Western | R5 | Not B1 or O1 | Not S1 or S2 or S3 | P | 1 |
11 Replies
- ryan_mayuSuper User
Anonymous
below is the formula for the 2&3. I am still not clear about the first one. could you pls provide elaberate on that? What's the output based on the sample data you provided?
_2 = if('Table'[Style_Merch] in {"B1","O1"}|| 'Table'[Model_Construction] in {"S1","S2","S3"},2,1)_3 = if('Table'[Markeing Type]="P",3,0)- AnonymousNot applicable
Thank you!
1 Should be the output whereby it computes the total point.The formula should be: distinct count of style#-season * base point (which should take into account #3) * complexity, i wish to have a measure that can sum this up.
- ryan_mayuSuper User
then use _2+ _3? is that what you wnat?
- AnonymousNot applicable
create a measure for
Complexity =IF( MAX('Table'[Style_Merch]) IN {"B1","O1"},2,IF(MAX('Table'[Model_Construction]) IN {"S1","S2","S3"},2,1))
After That create a measure for Total PointsTotal Point =var a = DISTINCTCOUNT('Table'[Style#-Season])return a*MAX('Table'[Base Point])*[Complexity]- AnonymousNot applicable
Thank you! Can you explain how do I add the criteria of Marketing Type into the measure as well?
3. If Marketing Type = P, add 3 points to Base Point, otherwise add 0 (no change)- AnonymousNot applicable
Anonymous use below measure for Total Point
Total Point =var a = DISTINCTCOUNT('Table'[Style#-Season])var basePoint = MAX('Table'[Base Point])var addTbase = IF(MAX('Table'[Markeing Type])="P",3,0) + basePointreturn a*addTbase*[Complexity]