Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Funnel with Array data set in Power BI

Hi,

 

I have a dataset with array column and user id column as shown below. A funnel chart is required to be plotted for step vs count user_id  in Power BI. The expected output is also provided below. The requirement is to check the step column for steps landingpage, registration_wall, logged_in, payment_details_provided, purchase_submitted if any of these steps is missing then count cannot be calculated. I have aadded an extra column to show count and cannot count if any step is missing. Please help me achieve this.

user_uuidstep 
1  
1landingpagecounted
1registration_wallcounted
1logged_incounted
1payment_details_providedcounted
1purchase_submittedcounted
2  
2  
2landingpagecounted
2registration_wallcounted
2logged_incounted
2payment_details_providedcounted
2purchase_submittedcounted
3  
4  
4  
4landingpagecounted
4registration_wallcounted
4logged_incounted
5  
5landingpage(cannot be counted)
6  
6landingpagecounted
6registration_wallcounted
6landingpage(cannot be counted as logged_in should be in this step)
7  
7  
7landingpagecounted
7logged_in(cannot be counted as registration_wall should be in this step)
7payment_details_provided(cannot be counted)
7purchase_submittedcounted

 

Expected output:

Funnel stepsCount User_id 
landingpage6
registration_wall4
logged_in3
payment_details_provided2
purchase_submitted2

 

Thanks in Advance,

Neelofar.

5 Replies

  • v-janeyg-msft's avatar
    v-janeyg-msft
    Community Support

    Hi, Anonymous 

     

    The logic you wrote seems to contradict the result displayed in the screenshot. Can you explain it?

     

     

    If you can explain it clearly, we can help you soon.

     

    Best Regards,
    Community Support Team _ Janey

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi @Community Support Team _ Janey,

      Thank you for the reply. Sorry it was a typo the columns which you have highlighted are counted so that it matches the screenshot result.

      • v-janeyg-msft's avatar
        v-janeyg-msft
        Community Support

        Anonymous 

         

        I don't understand what you mean, so what should be the excepted results?

  • v-janeyg-msft's avatar
    v-janeyg-msft
    Community Support

    Hi, Anonymous 

     

    According to your description, I create a sample.

    You need to create a index column in PQ first.

    Then create two columns to display the result you want.

    Like this:

    Column = 
    VAR a1 = "landingpage"
    VAR a2 = "registration_wall"
    VAR a3 = "logged_in"
    VAR a4 = "payment_details_provided"
    VAR a5 = "purchase_submitted"
    VAR tablea =
        FILTER (
            'Table',
            [Index]
                = EARLIER ( 'Table'[Index] ) - 1
                && [user_uuid] = EARLIER ( 'Table'[user_uuid] )
        )
    VAR tableb =
        FILTER (
            'Table',
            [Index]
                = EARLIER ( 'Table'[Index] ) + 1
                && [user_uuid] = EARLIER ( 'Table'[user_uuid] )
        )
    VAR b1 =
        MAXX ( tablea, [step] )
    VAR b2 =
        MAXX ( tableb, [step] )
    VAR b = [step]
    RETURN
        IF (
            b = a1
                && b1 = BLANK (),
            1,
            IF (
                b = a2
                    && b1 = a1,
                1,
                IF (
                    b = a3
                        && b1 = a2,
                    1,
                    IF ( b = a4 && b1 = a3, 1, IF ( b = a5 && b1 = a4, 1 ) )
                )
            )
        )
    
    Column 2 = 
    VAR a =
        MINX (
            FILTER (
                'Table',
                [step] <> BLANK ()
                    && [Column] = BLANK ()
                    && [user_uuid] = EARLIER ( 'Table'[user_uuid] )
            ),
            [Index]
        )
    RETURN
        IF ( a = BLANK (), [Column], IF ( [Index] > a, BLANK (), [Column] ) )
    

    Then count column2.


    Did I answer your question ? Please mark my reply as solution. Thank you very much.
    If not, please feel free to ask me.

     

    Best Regards,
    Community Support Team _ Janey