Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I need a measure that will calculate the following condition: if only two atributes D1 and D2 are selected in the slicer, the D1 value (100) should be multiplied (1.25) and then summ with the D2 value (100). Expected value result - 225.
In all other cases, only the Total Value result (for 1 - 100, for 2 - 200, for 3 - 300, for 4 - 400, for all - 500) should be displayed.
Current DAX is not working:
Solved! Go to Solution.
hi @DmitryAD7
Please try this measure
hi @DmitryAD7
Please try this measure
Thanks a lot!
Try this
Sales with Condition =
VAR _select = SELECTEDVALUE ( 'Dataset'[D] )
VAR _d1_value =
CALCULATE ( [Total Value], FILTER ( 'Dataset', 'Dataset'[D] = "D1" ) ) *1.25
VAR _d2_value =
CALCULATE ( [Total Value], FILTER ( 'Dataset', 'Dataset'[D] = "_D2" ) )
VAR _defualt_value =
CALCULATE ( [Total Value], FILTER ( 'Dataset', 'Dataset'[D] = "_select" ) )
VAR Result =
IF ( _select = "D1" && _select = "D2", CALCULATE(_d1_value+_d2_value),_defualt_value)
If it doesn't work, share a sample PBIX file.
Hi @DmitryAD7 ,
Try this:
I have used CONCATENATEX to build a string that contains the values selected in slicer and check if it is equal to "D1, D2"
VAR _select =
CONCATENATEX(
VALUES('Dataset'[D]),
'Dataset'[D],
", "
)
VAR _d1_value =
CALCULATE ( [Total Value], FILTER ( 'Dataset', 'Dataset'[D] = "D1" ) ) * 1.25
VAR _d2_value =
CALCULATE ( [Total Value], FILTER ( 'Dataset', 'Dataset'[D] = "D2" ) )
VAR _default_value =
CALCULATE ( [Total Value], FILTER ( 'Dataset', 'Dataset'[D] = "_select" ) )
VAR Result =
IF (
CONTAINSSTRING(_select,"D1, D2"),
CALCULATE ( _d1_value + _d2_value ),
_default_value
)
RETURN
Result
Sorry, but it still doesn't work.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
11 | |
11 | |
10 | |
10 |
User | Count |
---|---|
19 | |
14 | |
13 | |
11 | |
8 |