Forum Discussion

Shinu1's avatar
Shinu1
Helper II
5 years ago
Solved

Selection filter

Hi,

I have to make specific data selection from Raw data table based on Criteria table slicer. 

 

RawData Table

SourceDateExt Rev
GFS11/1/2019182
GFS1/1/2020102
NONGFS1/1/2019151
Altn1/1/2019126
Altn2/1/2019125
Altn3/1/2019115
Altn4/1/2019127
Altn5/1/2019199
Altn1/1/2020137
Altn2/1/2020170
Altn3/1/2020176
Altn4/1/2020197
Altn5/1/2020122

 

Criteria table

 

SourceDateView
Altn4/1/2020Const
Altn5/1/2020Const
GFS11/1/2019Const
GFS1/1/2020Const
NONGFS1/1/2019Const
Altn4/1/2019Org
Altn5/1/2019Org
Altn4/1/2020Org
Altn5/1/2020Org
GFS11/1/2019Org
GFS1/1/2020Org
NONGFS1/1/2019Org
Altn1/1/2019Pro
Altn2/1/2019Pro
Altn3/1/2019Pro
Altn4/1/2019Pro
Altn5/1/2019Pro
Altn1/1/2020Pro
Altn2/1/2020Pro
Altn3/1/2020Pro
Altn4/1/2020Pro
Altn5/1/2020Pro
GFS11/1/2019Pro
GFS1/1/2020Pro
NONGFS1/1/2019Pro

 

Understanding the "View"  field built in Criteria table is:

Const: if  Source = Altn then Criteria table does not have records with dates <= 31st Mar 2020 
Org:  if  Source = Altn then Criteria table does not have dates between 1st Jan 2019 to 31st Mar 2019 and 1st Jan 2020 to 31st Mar 2020
Pro: All dates and All Sources are available

 

I created Many to Many relationship between tables based on dates and kept the relationship active. Cross filter direction both.

But when i select "Org"  or "Const" from View slicer it does not affect the RawData table. Rawdata tables still shows the full data instead of data as per the dates in Criteria table

 

Please advise how do i achieve this.

 

Thanks

Shinu

 

 

 

 

 

  • Shinu1 

    Please use this measure:

    VisibleFlag = 
    
    VAR _VIEW = SELECTEDVALUE(Criteria[View]) 
    VAR _SOURCE =  SELECTEDVALUE('Raw Data'[Source])
    VAR _DATE = SELECTEDVALUE('Raw Data'[Date])
    RETURN
    IF( _VIEW = "Const",
        IF(_SOURCE = "Altn" && _DATE <= DATE(2020,3,31),1,0), 
            IF( _VIEW = "Org",
                IF( _SOURCE = "Altn" &&  
                    (
                        (_DATE >= DATE(2019,1,1) && _DATE <= DATE(2019,3,31)) || (_DATE >= DATE(2020,1,1) && _DATE <= DATE(2020,3,31))
                    )
                    ,1
                    ,
                    0)
                    
                ,
                0
            )
    )

     

    ________________________

    If my answer was helpful, please consider Accept it as the solution to help the other members find it

    Click on the Thumbs-Up icon if you like this reply 🙂

    YouTube  LinkedIn

7 Replies

  • Shinu1 

    Not quite clear about your requirement.  Can you show the expected output, better if you could share a sample PBIX file?

    ________________________

    If my answer was helpful, please consider Accept it as the solution to help the other members find it

    Click on the Thumbs-Up icon if you like this reply 🙂

    YouTube  LinkedIn

    • Shinu1's avatar
      Shinu1
      Helper II

      Here is the output that I'm looking for based on slicer selections:

      View (Slicer contains three options)

      Org

      Const

      Pro

       

      When "Org" is selected, below is the output table. The commented rows must not be visible. The comment column is just for additional information. This field is not available in any table.

      SourceDateExt RevComments
      GFS11/1/2019182 
      GFS1/1/2020102 
      NONGFS1/1/2019151 
      Altn1/1/2019126Source = Altn and dates  between 1st Jan 2019 to 31st Mar 2019 and 1st Jan 2020 to 31st Mar 2020  must not be visible
      Altn2/1/2019125Source = Altn and dates  between 1st Jan 2019 to 31st Mar 2019 and 1st Jan 2020 to 31st Mar 2020  must not be visible
      Altn3/1/2019115Source = Altn and dates  between 1st Jan 2019 to 31st Mar 2019 and 1st Jan 2020 to 31st Mar 2020  must not be visible
      Altn4/1/2019127 
      Altn5/1/2019199 
      Altn1/1/2020137Source = Altn and dates  between 1st Jan 2019 to 31st Mar 2019 and 1st Jan 2020 to 31st Mar 2020  must not be visible
      Altn2/1/2020170Source = Altn and dates  between 1st Jan 2019 to 31st Mar 2019 and 1st Jan 2020 to 31st Mar 2020  must not be visible
      Altn3/1/2020176Source = Altn and dates  between 1st Jan 2019 to 31st Mar 2019 and 1st Jan 2020 to 31st Mar 2020  must not be visible
      Altn4/1/2020197 
      Altn5/1/2020122 

       

       

      When "Const" is selected, below is the output table. The commented rows must not be visible

      SourceDateExt RevComments
      GFS11/1/2019182 
      GFS1/1/2020102 
      NONGFS1/1/2019151 
      Altn1/1/2019126Source = Altn and dates  less than 31st Mar 2020  must not be visible
      Altn2/1/2019125Source = Altn and dates  less than 31st Mar 2020  must not be visible
      Altn3/1/2019115Source = Altn and dates  less than 31st Mar 2020  must not be visible
      Altn4/1/2019127Source = Altn and dates  less than 31st Mar 2020  must not be visible
      Altn5/1/2019199Source = Altn and dates  less than 31st Mar 2020  must not be visible
      Altn1/1/2020137Source = Altn and dates  less than 31st Mar 2020  must not be visible
      Altn2/1/2020170Source = Altn and dates  less than 31st Mar 2020  must not be visible
      Altn3/1/2020176Source = Altn and dates  less than 31st Mar 2020  must not be visible
      Altn4/1/2020197 
      Altn5/1/2020122 

       

      When "Pro" is selected, below is the output table. All rows must be visible.

      SourceDateExt RevComments
      GFS11/1/2019182All data to be displayed
      GFS1/1/2020102All data to be displayed
      NONGFS1/1/2019151All data to be displayed
      Altn1/1/2019126All data to be displayed
      Altn2/1/2019125All data to be displayed
      Altn3/1/2019115All data to be displayed
      Altn4/1/2019127All data to be displayed
      Altn5/1/2019199All data to be displayed
      Altn1/1/2020137All data to be displayed
      Altn2/1/2020170All data to be displayed
      Altn3/1/2020176All data to be displayed
      Altn4/1/2020197All data to be displayed
      Altn5/1/2020122All data to be displayed

       

      Hope the above helps to understand my requirement