Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Shinu1
Helper II
Helper II

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

 

 

 

 

 

1 ACCEPTED SOLUTION

@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

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

7 REPLIES 7
Fowmy
Super User
Super User

@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

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

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

@Shinu1 

Create the following measure, and assign it to the visual filter of the table visual and set to = 0

You can download the file: HERE



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" &&  NOT(_DATE >= DATE(2019,1,1) && _DATE <= DATE(2019,3,31)) && NOT(_DATE >= DATE(2020,1,1) && _DATE <= DATE(2020,3,31)),1,0)
    ,
    0
)

Fowmy_0-1604240285102.png

________________________

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

 




Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Hi Fowmy,

Is it possible that i do this workout without creating a measure just by creating relationships ?

 

I checked the output, the Const and Pro selection looks fine but the Org selection is showing incorrect output.

if  Source = Altn and dates between 1st Jan 2019 to 31st Mar 2019 and 1st Jan 2020 to 31st Mar 2020  must not be displayed.

The Org output should look like the below table

SourceDateExt Rev
GFS11/1/2019182
GFS1/1/2020102
NONGFS1/1/2019151
Altn4/1/2019127
Altn5/1/2019199
Altn4/1/2020197
Altn5/1/2020122
Total 1080

 

 

Regards

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

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Thankyou very much Fowmy. The output looks good.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.