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
glimpse111
New Member

Filter and slice selected column

Hi guys,

 

I need some help to apply filter to the following data. Some of customers are suspended from May 18 onwards so their sales number should not be included from May onwards. How can I apply filter which will include the data for selected customer from Oct-April but not from May-Sep. Is there anyway I can do this without removing the numbers from rows as I would need these numbers to tell what is the sale for suspended customers from May-Sep.

 

Many thanks in advance!

 

 

 

IDCustomer NameStatusOct-17Nov-17Dec-17Jan-18Feb-18Mar-18Apr-18May-18Jun-18Jul-18Aug-18Sep-18YTDTotal
16CR05AActive     11.13     11.82     12.11     12.88     11.61     11.79     10.22         9.84         9.77         9.94         9.74     10.05   111.10   130.90
16CR10BActive     10.02     10.64     10.90     11.59     10.45     10.61         9.20         8.86         8.80         8.94         8.76         9.05   100.00   117.81
16CR12CActive         3.34         3.55         3.63         3.86         3.48         3.54         3.07         2.95         2.93         2.98         2.92         3.02     33.33     39.27
16CR13DActive         4.45         4.73         4.85         5.15         4.64         4.72         4.09         3.94         3.91         3.97         3.89         4.02     44.44     52.36
16CR21EActive     11.13     11.82     12.11     12.88     11.61     11.79     10.22         9.84         9.77         9.94         9.74     10.05   111.10   130.90
16CR24FActive         4.45         4.73         4.85         5.15         4.64         4.72         4.09         3.94         3.91         3.97         3.89         4.02     44.44     52.36
16CR28GActive     13.35     14.19     14.54     15.45     13.93     14.15     12.26     11.81     11.73     11.92     11.68     12.07   133.33   157.08
16CR29HActive     13.35     14.19     14.54     15.45     13.93     14.15     12.26     11.81     11.73     11.92     11.68     12.07   133.33   157.08
16CR35IActive     11.13     11.82     12.11     12.88     11.61     11.79     10.22         9.84         9.77         9.94         9.74     10.05   111.10   130.90
16CR47JActive     11.13     11.82     12.11     12.88     11.61     11.79     10.22         9.84         9.77         9.94         9.74     10.05   111.10   130.90
16CR50KSuspended from Jan     11.13     11.82     12.11     12.88     11.61     11.79     10.22         9.84         9.77         9.94         9.74     10.05   111.10   130.90
16CR53LSuspended     10.02     10.64     10.90     11.59     10.45     10.61         9.20         8.86         8.80         8.94         8.76         9.05   100.00   117.81
16CR55MSuspended     11.13     11.82     12.11     12.88     11.61     11.79     10.22         9.84         9.77         9.94         9.74     10.05   111.10   130.90
16CR57NSuspended     11.13     11.82     12.11     12.88     11.61     11.79     10.22         9.84         9.77         9.94         9.74     10.05   111.10   130.90
1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @glimpse111,

 

Is there any columns store suspend date?
If this is a case, you can write a measure to use current date ,customer name and id to find out related suspend date, then add if statement to replace records who after suspend date. Use this measure to replace value column.

 

Sample:

Replaced result =
VAR currDate =
    MAX ( Table[Date] )
VAR currCustomer =
    SELECTEDVALUE ( Table[Customer Name] )
VAR currID =
    SELECTEDVALUE ( Table[ID] )
VAR suspended =
    CALCULATE (
        MAX ( Table[Suspend] ),
        FILTER ( ALL ( Table ), [ID] = currID && [Customer Name] = currCustomer )
    )
RETURN
    IF (
        currDate <= suspended
            || suspended = BLANK (),
        SUM ( table[Amount] ),
        IF ( currDate > suspended, blank )
    )

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @glimpse111,

 

Is there any columns store suspend date?
If this is a case, you can write a measure to use current date ,customer name and id to find out related suspend date, then add if statement to replace records who after suspend date. Use this measure to replace value column.

 

Sample:

Replaced result =
VAR currDate =
    MAX ( Table[Date] )
VAR currCustomer =
    SELECTEDVALUE ( Table[Customer Name] )
VAR currID =
    SELECTEDVALUE ( Table[ID] )
VAR suspended =
    CALCULATE (
        MAX ( Table[Suspend] ),
        FILTER ( ALL ( Table ), [ID] = currID && [Customer Name] = currCustomer )
    )
RETURN
    IF (
        currDate <= suspended
            || suspended = BLANK (),
        SUM ( table[Amount] ),
        IF ( currDate > suspended, blank )
    )

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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.