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
Anonymous
Not applicable

cumulative account on the line

Hi everyone,

I got one more problem...

 

I got one table with my customer. Each one has a starting date (start to be a customer) and an ending date (stop to be our customer).

I would like the number of customer month by month!

For sure, I got one date table with format AAAA_MM (and others).

 

Exemple :

Customer      Start              End

blabla           02/05/2018    

blabla2         04/07/2018   05/08/2018

blabla3         12/08/2018   10/10/2018

blabla4         13/09/2018

 

So, I have to get this :

Month        Nb_Customer

01/2018     0

02/2018     0

03/2018     0

04/2018     0

05/2018     1

06/2018     1

07/2018     2

08/2018     2

09/2018     3

10/2018     2

 

Thank you for all your support for many times,

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Ok,

sorry for my delay

 

I did that and it's working :

 

Nb_Adhésions_cumulées = CALCULATE(CALCULATE(
COUNT( BI_TIERS[Num_Tiers] );
FILTER( ALL(BI_TIERS);
COUNTX( FILTER( BI_TIERS; EARLIER( BI_TIERS[AAAA_MM_DebutAdhesion] ) <= BI_TIERS[AAAA_MM_DebutAdhesion] );
BI_TIERS[AAAA_MM_DebutAdhesion]));
BI_TIERS[AAAA_MM_DebutAdhesion]<>"";
USERELATIONSHIP(BI_TIERS[AAAA_MM_DebutAdhesion];BI_DATE[Année_Mois]))
-
CALCULATE(
COUNT( BI_TIERS[Num_Tiers]);
FILTER( ALL(BI_TIERS) ;
COUNTX( FILTER( BI_TIERS; EARLIER( BI_TIERS[AAAA_MM_FinAdhesion] ) <= BI_TIERS[AAAA_MM_FinAdhesion] );
BI_TIERS[AAAA_MM_FinAdhesion]));
BI_TIERS[AAAA_MM_FinAdhesion]<>"";
USERELATIONSHIP(BI_TIERS[AAAA_MM_FinAdhesion];BI_DATE[Année_Mois]));
Filter(ALL(BI_DATE);BI_DATE[Année_Mois]<=max(BI_DATE[Année_Mois])))

 

with "Fin d'adhésion" the endind date and "Debut Adhésion" the starting date and "Num_Tiers" the n°customer.

 

Thank you for all,

View solution in original post

2 REPLIES 2
v-yulgu-msft
Employee
Employee

Hi @Anonymous,

 

Please first create a calendar table:

Dim date = FILTER( CALENDAR(DATE(2018,1,1),DATE(2018,12,31)),DAY([Date])=1)

1.PNG

 

Create a calculated table with below formula:

Result Table = 
VAR temp =
    ADDCOLUMNS (
        CROSSJOIN ( Test3, 'Dim date' ),
        "check", IF (
            ( [Date].[Year] >= Test3[Start].[Year]
                && [Date].[MonthNo] >= Test3[Start].[MonthNo] )
                && (
                    Test3[End] = BLANK ()
                        || ( [Date].[Year] <= Test3[End].[Year]
                        && [Date].[MonthNo] < [End].[MonthNo] )
                ),
            1,
            0
        )
    )
RETURN
    GROUPBY (
        temp,
        [Date].[Year],
        [Date].[MonthNo],
        "Nb_Customer", SUMX ( CURRENTGROUP (), [check] )
    )

2.PNG

 

Best regards,

Yuliana Gu

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

Ok,

sorry for my delay

 

I did that and it's working :

 

Nb_Adhésions_cumulées = CALCULATE(CALCULATE(
COUNT( BI_TIERS[Num_Tiers] );
FILTER( ALL(BI_TIERS);
COUNTX( FILTER( BI_TIERS; EARLIER( BI_TIERS[AAAA_MM_DebutAdhesion] ) <= BI_TIERS[AAAA_MM_DebutAdhesion] );
BI_TIERS[AAAA_MM_DebutAdhesion]));
BI_TIERS[AAAA_MM_DebutAdhesion]<>"";
USERELATIONSHIP(BI_TIERS[AAAA_MM_DebutAdhesion];BI_DATE[Année_Mois]))
-
CALCULATE(
COUNT( BI_TIERS[Num_Tiers]);
FILTER( ALL(BI_TIERS) ;
COUNTX( FILTER( BI_TIERS; EARLIER( BI_TIERS[AAAA_MM_FinAdhesion] ) <= BI_TIERS[AAAA_MM_FinAdhesion] );
BI_TIERS[AAAA_MM_FinAdhesion]));
BI_TIERS[AAAA_MM_FinAdhesion]<>"";
USERELATIONSHIP(BI_TIERS[AAAA_MM_FinAdhesion];BI_DATE[Année_Mois]));
Filter(ALL(BI_DATE);BI_DATE[Année_Mois]<=max(BI_DATE[Année_Mois])))

 

with "Fin d'adhésion" the endind date and "Debut Adhésion" the starting date and "Num_Tiers" the n°customer.

 

Thank you for all,

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.