Forum Discussion

LilaySlays's avatar
LilaySlays
Regular Visitor
2 years ago
Solved

Measure based on slicer selection from another table

Hello community,


In the table "Reports," there are the following columns: Date, Info, and Week_No. In the table "Dates," there are the following columns: GID, Week number, PEP. The two tables are linked by the Week number. On the report page, I am using a filter with the "Week_No" column from the "Reports" table. When I set the filter to a specific week, I want a table to display the values of the "PEP" column if the Week number from the "Dates" table is equal to the selected Week number + 1.

 


With the following measure I only get blank values:

 

PEP_KW1 = 
VAR SelectedWeek = SELECTEDVALUE(Reports[Week_No])
VAR TargetWeek = SelectedWeek + 1
RETURN
CALCULATE(
            FIRSTNONBLANK(Termine[PEP],1),
             FILTER(
                Termine,
                Termine[Week_no] = TargetWeek
             )
)

 



Thanks for your help.


  • Hallo everyone,

    I have been able to solve the problem. Here is the solution:

    x_KW1 = 
    VAR SelectedWeek = SELECTEDVALUE(report[KW])
    VAR NextWeek = SelectedWeek + 1
    RETURN
    CONCATENATEX(
        FILTER(
        'time',  
        'time'[KW] = NextWeek
    ),
    'time'[x],
    UNICHAR(10)
    )

4 Replies

  • LilaySlays's avatar
    LilaySlays
    Regular Visitor

    Hallo everyone,

    I have been able to solve the problem. Here is the solution:

    x_KW1 = 
    VAR SelectedWeek = SELECTEDVALUE(report[KW])
    VAR NextWeek = SelectedWeek + 1
    RETURN
    CONCATENATEX(
        FILTER(
        'time',  
        'time'[KW] = NextWeek
    ),
    'time'[x],
    UNICHAR(10)
    )
  • Maybe try to change the part in the FILTER() to:

    FILTER(
                    ALL(Termine[Week_no]),
                    Termine[Week_no] = TargetWeek
                 )

     

  • LilaySlays's avatar
    LilaySlays
    Regular Visitor

    Ok, it is now working. I deactivated the relationship between the both table. But It only shows me 1 result when more matches are expected.