Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Filter two tables, code provided but incomplete, requires DAX knowledge

I am having trouble filtering two tables based on eachothers values i.e. date, wholenumber(litra),  etc. see example:

 

I would like to filter table B using table A as reference in what to filter in B. 

I would like to have the possiblity to choose to filter the table B to show data with dates equal to or above the reference date shown in table A ( so its if table A has: Litra: 2001, Fokus Gruppen: 50% Traktion, Date: 05/09/2019. The table B should show the same filtering except the Date must be equal to or newer than the table A, since it is the data that is dynamic and changing per update.

 

I have a measure code for the tables, which is abit incomplete and doesnt really filter the date, however it does the job for the Litra and Fokus Gruppen.

 

If possible I also want to filter on the Fejlkode column, as long as there is value in it, else it must not filter it.

 

Gentaget = 
VAR temp =
    SELECTCOLUMNS (
        ALLSELECTED ( Fokustog );
        "Dato"; [Litra] & " " & [Fokus gruppen] & " " & [Dato]
    )
VAR currLitra =
    SELECTEDVALUE ( 'TCI2-ER'[Litra] )
VAR currFokus =
    SELECTEDVALUE ( 'TCI2-ER'[Fejlgruppe] )
VAR currdato =
    SELECTEDVALUE ( 'TCI2-ER'[Dato] )   
RETURN
    IF ( currLitra & " " & currFokus  & " " & CALCULATE(currdato;currdato > Fokustog[Dato]) IN temp; "JA"; "NEJ" )

Thank you for your help

2 Replies

  • Icey's avatar
    Icey
    Community Support

    Hi Anonymous ,

     

    Maybe you colud create a table.

    Table =
    SELECTCOLUMNS (
        ADDCOLUMNS (
            SUMMARIZE (
                'TCI2-ER',
                'TCI2-ER'[Dato],
                'TCI2-ER'[Fejlgruppe],
                'TCI2-ER'[Fejlkode],
                'TCI2-ER'[Litra]
            ),
            "M", [Gentaget]
        ),
        "MM", [M]
    )

    Best Regards,

    Icey

     

    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

      HI thanks

       

      But it does not work as intended. It does nothing as the date it shows is not equal or more than the Fokustog table.

      The measure i showed is working correct except it isnt showing dates correctly.