Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Calculated Measure based on two different slicers

Hi,
I have two slicers that comes from different tables. Now need to create a measure based on these slicers.

For example,
If one slicer is of date table

The other slicer is from dept table

Need to calculate a measure based on these two slicers.


3 Replies

  • Anonymous , if they joined with the table if the filter automatically . If they are disconnected

     

    calculate([measure],filter(Table, Table[date] in allselected(Date[date]) && Table[dept ] in allselected(dept [dept])))

    calculate([measure],filter(Table, Table[date] in values(Date[date]) && Table[dept ] in values(dept [dept])))

     

     

  • FarhanAhmed's avatar
    FarhanAhmed
    Community Champion

    Can you please share sample data ?

     

    You need to create relationship between your tables and then create measure 

    Then you need to  create Slicer from Date & Other table

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

    Hi Anonymous ,

     

    I create a simple sample that contains two slicers from different tables and create a measure to do calculation dynamically.

    Measure =
    VAR selectedvalue =
        SELECTEDVALUE ( Slicer[Country] )
    RETURN
        CALCULATE (
            SUM ( 'Table'[Sales] ),
            FILTER (
                'Table',
                'Table'[Country] = selectedvalue
                    && 'Table'[Date] >= MIN ( 'Date'[Date] )
                    && 'Table'[Date] <= MAX ( 'Date'[Date] )
            )
        )
    

     

    Note: The slicers tables are unconnected. There is no relationship among the three tables. If there is one, the result will be affected by it.