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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Filter a Date but showing other dates on a visual

Hello guys,

 

I need your help please 🙂

 

Let's consider the following sample :

CustomerDate_EntranceDate_LeftAdress

CustomerDate_EntranceDate_LeftAdress

CUST_115/04/202228/08/2022Adress_1
CUST_115/04/202228/08/2022Adress_2
CUST_208/02/202201/09/2022Adress_1
CUST_310/02/202206/12/2022Adress_1
CUST_415/01/202230/06/2022Adress_1
CUST_515/03/202230/06/2022Adress_1
CUST_515/03/202230/06/2022Adress_2
CUST_605/01/202202/12/2022Adress_1
CUST_708/01/202231/12/2022Adress_1
CUST_812/01/202218/09/2022Adress_1
CUST_904/03/202209/09/2022Adress_1
CUST_1005/03/2022 Adress_1
CUST_1106/03/2022 Adress_1
CUST_1207/03/2022 Adress_1
CUST_1308/03/2022 Adress_1
CUST_1409/03/2022 Adress_1
CUST_1409/03/2022 Adress_2

Mohamed_59_7-1672769988509.png

 

Mohamed_59_4-1672769285718.png

Mohamed_59_6-1672769667696.png

(this result above is not what I want)

Is there a way to display on the visual the customer who have been hired on a particular month

AND

showing them with the date they have left ?

 

For exemple, if I select on the filter : march 2022

I should see on the visual 5 customers hired on march 2022 who are still in the company

; 1 customer on june 2022 who have left

; 1 customer on september 2022 who have left

(which is not what you see on my visual above)

 

Thank you !

 

 

 

1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @Anonymous ,

I create a sample pbix file(see the attachment), please check if that is what you want. 

1. Do not create any relationship between the table Dim_Date and Customers

yingyinr_1-1672813504754.png

2. Create two measures as below to get the count of customers for in and out

Nb of customers IN = 
VAR _selym =
    SELECTEDVALUE ( 'Dim_Date'[YearMonth] )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( Customer[Customer] ),
        FILTER (
            'Customer',
            YEAR ( 'Customer'[Date_Entrance] ) & FORMAT ( 'Customer'[Date_Entrance], "MM" ) = _selym
                && (
                    'Customer'[Date_Left] >= TODAY ()
                        || ISBLANK ( 'Customer'[Date_Left] )
                )
        )
    )
Nb of customers OUT = 
VAR _selym =
    SELECTEDVALUE ( 'Dim_Date'[YearMonth] )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( Customer[Customer] ),
        FILTER (
            'Customer',
            YEAR ( 'Customer'[Date_Entrance] ) & FORMAT ( 'Customer'[Date_Entrance], "MM" ) = _selym
                && YEAR ( 'Customer'[Date_Left] ) & FORMAT ( 'Customer'[Date_Left], "MM" )
                    = SELECTEDVALUE ( 'Customer'[LYM] )
                && NOT ( ISBLANK ( 'Customer'[Date_Left] ) )
                    && 'Customer'[Date_Left] < TODAY ()
        )
    )

3. Create a visual as below

yingyinr_0-1672813423474.png

If the above one can't help you get the expected result, please provide more raw data in your table 'Customers' (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yiruan-msft
Community Support
Community Support

Hi @Anonymous ,

I create a sample pbix file(see the attachment), please check if that is what you want. 

1. Do not create any relationship between the table Dim_Date and Customers

yingyinr_1-1672813504754.png

2. Create two measures as below to get the count of customers for in and out

Nb of customers IN = 
VAR _selym =
    SELECTEDVALUE ( 'Dim_Date'[YearMonth] )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( Customer[Customer] ),
        FILTER (
            'Customer',
            YEAR ( 'Customer'[Date_Entrance] ) & FORMAT ( 'Customer'[Date_Entrance], "MM" ) = _selym
                && (
                    'Customer'[Date_Left] >= TODAY ()
                        || ISBLANK ( 'Customer'[Date_Left] )
                )
        )
    )
Nb of customers OUT = 
VAR _selym =
    SELECTEDVALUE ( 'Dim_Date'[YearMonth] )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( Customer[Customer] ),
        FILTER (
            'Customer',
            YEAR ( 'Customer'[Date_Entrance] ) & FORMAT ( 'Customer'[Date_Entrance], "MM" ) = _selym
                && YEAR ( 'Customer'[Date_Left] ) & FORMAT ( 'Customer'[Date_Left], "MM" )
                    = SELECTEDVALUE ( 'Customer'[LYM] )
                && NOT ( ISBLANK ( 'Customer'[Date_Left] ) )
                    && 'Customer'[Date_Left] < TODAY ()
        )
    )

3. Create a visual as below

yingyinr_0-1672813423474.png

If the above one can't help you get the expected result, please provide more raw data in your table 'Customers' (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hello @v-yiruan-msft 

It Works for me.

Thank you for your help !

TomMartens
Super User
Super User

Hey @Anonymous ,

 

this is not possible!

If you are filtering the dates visible on a chart by using a slicer, the axis content can not be expanded.

You have to use a second date table used on the visual that is not related to the data or to the fact table. This "concept" is called the disconnected table. If you are using the search engine of your choice, you will find many examples.

Hopefully, this provides an idea of how to tackle your challenge.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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