Forum Discussion

Hactogeek's avatar
Hactogeek
Frequent Visitor
8 years ago

Calculated Column with filter on selected values

Hi everyone,

 

I need to update my calculated column values based on user selections in the report.

 

I tried a lot of DAX formula but no way to reach my goal.

 

My DAX formula :

 

 

Colonne = CALCULATE(
	COUNT(InLaneEvents[CardId]);
	FILTER(
        InLaneEvents;
        (INT(InLaneEvents[To]) <= AllDay[Date])
        && (INT(InLaneEvents[From]) >= AllDay[Date] || INT(InLaneEvents[From]) = BLANK())
        /*&& (SEARCH(InLaneEvents[Id];CONCATENATEX(VALUES(Lanes[Id]);Lanes[Id];",");;-1) <> -1)*/
        /*&& CONTAINS(VALUES(Lanes);Lanes[Id]; InLaneEvents[Id])*/
    );
    ALLSELECTED(InLaneEvents)  
)

 

The relationship between InLaneEvents[Id] and Lanes[Id] exists in both directions.

 

My slicer is on Lanes[Id] but I also tried to put it on InLanesEvents[Id] without success.

 

I am wondering now if it is possible.

 

Thank you for your help.

 

TonyM

 

1 Reply

  • v-yuta-msft's avatar
    v-yuta-msft
    Community Support

    Hi Hactogeek,

     

    As a general suggestion, you may should try ALLSELECTED(InLaneEvents[Id]) Instead of ALLSELECTED(InLaneEvents) because there're some difference between them.  ALLSELECTED(InLaneEvents) will remove all the filters in table InLaneEvents while ALLSELECTED(InLaneEvents[Id]) only remove the column filter.  For details, please also refer to: https://www.sqlbi.com/articles/understanding-allselected/.

     

    Regards,
    Jimmy Tao