Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. 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.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 8 | |
| 8 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 23 | |
| 13 | |
| 10 | |
| 6 | |
| 5 |