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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
timazarj
Helper II
Helper II

How to check if a client become quoted?

Hello,

I have a sample table summarizing clients: I need to know how many of them became quoted within the last 4 months ( Users filter the report via date slicer in relationship with LogDate).

ClientIdClientLogLogDate
2686New2022-11-10
2686Rick Johnson2022-11-10
13030New2019-05-21
13030Contact Attempt 12019-05-27
13030Contact Attempt 22019-07-19
13030Requote2019-07-29
13030New2022-10-18
13030Rick Johnson2022-10-18
13030Contact Attempt 12022-10-24
13030Contact Attempt 22022-10-28
13030Contact Attempt 32022-11-02
13030Nurture2022-11-07
37661Quoted2020-02-04
37661Quote Follow-up 12020-02-21
37661Quote Follow-up 22020-02-24
37661Quote Follow-up 32020-02-27
37661Nurture2020-03-09
37661New2022-10-24
37661Rick Johnson2022-10-24
37661Contact Attempt 12022-10-28
37661Contact Attempt 22022-10-31
37661Contact Attempt 32022-11-02
37661Nurture2022-11-03
67206Contacted/Call Back2022-09-26
67206Quoted2022-09-28
67206Archive2022-10-03
67480 2022-10-05
67480Courtney Elliott2022-10-05
67480Emily Clarke2022-10-05
67480Requote2022-10-05
67480Rick Johnson2022-10-05
69922Policy Sold2022-10-21
69925Emily Clarke2022-10-21
69925Rick Johnson2022-10-21
69925Do Not Call2022-11-01
69933Kim George2022-10-21
69933Quoted2022-10-21
69933Rick Johnson2022-10-21
69933 2022-10-24
69933Quote Follow-up 12022-10-24
69933 2022-10-27
69933Quote Follow-up 22022-10-27
69933 2022-10-31
69933Quote Follow-up 32022-10-31
69933 2022-11-04
69933Quote Follow-up 42022-11-04

 I need the result below: 

ClientIdLead Become Quoted Within Last four months(LogObject=Quoted) 
26860 
130300 
130300 
376610it became "Quoted" before the last 4 months 
672061it became "Quoted" in Sep, last four month
674800 
699220 
699250 
699331it became "Quoted" last month

 

Please help me.

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

Hi @timazarj ,

 

Please try:

Lead Become Quoted Within Last four months =
VAR _a =
    SELECTCOLUMNS ( 'Table', "Log", [ClientLog] )
VAR _b =
    CALCULATE (
        MAX ( 'Table'[LogDate] ),
        FILTER ( 'Table', [ClientLog] = "Quoted" )
    )
RETURN
    IF ( "Quoted" IN _a && _b >= EDATE ( TODAY (), -4 ) && _b <= TODAY (), 1, 0 )

Output:

vjianbolimsft_1-1670208343337.png

Best Regards,

Jianbo Li

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

5 REPLIES 5
v-jianboli-msft
Community Support
Community Support

Hi @timazarj ,

 

Please try:

Lead Become Quoted Within Last four months = 
VAR _a =
    SELECTCOLUMNS ( FILTER(ALL('Table'),[ClientId]=MAX('Table'[ClientId])), "Log", [ClientLog] )
VAR _b =
    CALCULATE (
        MAX ( 'Table'[LogDate] ),
        FILTER ( FILTER(ALL('Table'),[ClientId]=MAX('Table'[ClientId])), [ClientLog] = "Quoted" )
    )
RETURN
    IF ( "Quoted" IN _a && _b >= EDATE ( TODAY (), -4 ) && _b <= TODAY (), 1, 0 )

Final output:

vjianbolimsft_0-1670390346113.png

Best Regards,

Jianbo Li

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

 

v-jianboli-msft
Community Support
Community Support

Hi @timazarj ,

 

Please try:

Lead Become Quoted Within Last four months =
VAR _a =
    SELECTCOLUMNS ( 'Table', "Log", [ClientLog] )
VAR _b =
    CALCULATE (
        MAX ( 'Table'[LogDate] ),
        FILTER ( 'Table', [ClientLog] = "Quoted" )
    )
RETURN
    IF ( "Quoted" IN _a && _b >= EDATE ( TODAY (), -4 ) && _b <= TODAY (), 1, 0 )

Output:

vjianbolimsft_1-1670208343337.png

Best Regards,

Jianbo Li

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

Thank you for the response. However, it doesn't work properly. 

in the model, you attached, if you add the log column to the table it only showed 1 when the log is "Quoted"

timazarj_0-1670357425580.png

 

 

timazarj
Helper II
Helper II

Hi,

Thank you!

However, it must show 1 for all the clientID=69933 and 67206.

Bifinity_75
Solution Sage
Solution Sage

Hi @timazarj , try this calculate column:

Lead Become Quoted Within Last four months = if(Table1[ClientLog]="Quoted" && 
            Table1[LogDate]>=DATE(YEAR(TODAY()),MONTH(TODAY())-4,DAY(TODAY()))
            ,1,0
            )

 

The result:

Bifinity_75_0-1669670364100.png

 

Best regards

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.