Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Dynamic value in measure

Total =
var _nl ="
"
var _selected = CONCATENATEX(VALUES('Commitment Rundown'[Date]),FORMAT('Commitment Rundown'[Date],"dd-mmm-yy"),_nl)
return 
CALCULATE(DISTINCTCOUNT('Commitment Rundown'[LTP]),
    FILTER('Commitment Rundown',FIND(FORMAT([Baseline Finish WE],"dd-mmm-yy"),_selected,1,-2)<>-2 &&
                                FIND(FORMAT([RFSU Forecast WE],"dd-mmm-yy"),_selected,1,-2)<>-2))
 
Hi y'all. Here's the dax formula. And it doesn't work as it should be, because it doesn't get you the selected value inside the formula but only on exit, checked with visual.
Is there any way to do this?
I want to filter out the data so my other two dates [baseline finish] and [RFSU forecast] are in the range of selected date.
It's in same table so the option with the date table joined to main table won't work cause one relationship will be inactive, unless I miss something
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous ,

    Please try the following DAX formula and check if they can solve the problem:

    Total = 
    VAR _selectedDates = VALUES('Commitment Rundown'[Date])
    RETURN
    CALCULATE(
        DISTINCTCOUNT('Commitment Rundown'[LTP]),
        FILTER(
            'Commitment Rundown',
            'Commitment Rundown'[Baseline Finish WE] IN _selectedDates &&
            'Commitment Rundown'[RFSU Forecast WE] IN _selectedDates
        )
    )

     

    Best Regards,

    Wisdom Wu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    Please try the following DAX formula and check if they can solve the problem:

    Total = 
    VAR _selectedDates = VALUES('Commitment Rundown'[Date])
    RETURN
    CALCULATE(
        DISTINCTCOUNT('Commitment Rundown'[LTP]),
        FILTER(
            'Commitment Rundown',
            'Commitment Rundown'[Baseline Finish WE] IN _selectedDates &&
            'Commitment Rundown'[RFSU Forecast WE] IN _selectedDates
        )
    )

     

    Best Regards,

    Wisdom Wu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Anonymous 
      Thank you very much, it works! YAY!!!