- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

IF ELSE in measure using DAX
Dear All,
I have the folllwing situation:
I want to create a measure showing the result of two types of margins. Depending on the type of product, a certain margin percentage applies. I have simplyfied the sitution below:
The result should be a measure (in red) and is making use of a margin scheme which can be hardcoded in DAX. The margin scheme isn't a separate table,; it's just published to show the margin percentages used.
I am think to make use of a IF ELSE forumlua within DAX. Any other suggestion / solution is welcome.
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

@Anonymous create this caclulated column:
Result =
'Table'[price] * IF('Table'[Type = "Normal", 0.1, 0.2)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

@Anonymous create this caclulated column:
Result =
'Table'[price] * IF('Table'[Type = "Normal", 0.1, 0.2)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Thanks again for your prossible solution.
However, when I run this formula, I get the message that I need to aggregate with Minimum, Maximum, Nummber of Sum function on field 'Table[Type]'. How can I solve this?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

@Anonymous hey, just to make sure, cause I missed a columm bracket there, you tried:
Result =
'Table'[price] * IF('Table'[Type] = "Normal", 0.1, 0.2)
And you got that message?
That means you try to create a visaul and not a calculated column.
Try:
Result =
SUMX(
'Table',
'Table'[price] * IF('Table'[Type] = "Normal", 0.1, 0.2)
)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Thanks a lot for this additional suggestion.
However when I use this forumla, I still get a message that column / field [Type] in table 'Table' cannot be found, but this field is a field / column in table 'Table'.
Thanks for any additional suggestion
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

@Anonymous hey, will PM you now

Helpful resources
Subject | Author | Posted | |
---|---|---|---|
06-19-2024 08:36 AM | |||
03-18-2024 11:33 PM | |||
05-24-2024 09:21 AM | |||
01-02-2020 11:53 AM | |||
08-13-2024 03:40 PM |
User | Count |
---|---|
114 | |
90 | |
86 | |
54 | |
46 |