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

Calculate first keyword and calculate a keywordpath

Hi everyone,


Can someone help me with the DAX-formulas First Keyword and Keywordpath?

 

FirstKeyword for each customer

I've got the following table and I want a column with the first keyword for each customer, see photo below.

 

FirstKeyword.PNG

 

The next challenge is the KeywordPath:

For each customer I want to calculate the KeywordPath, see photo below.

 

KeywordPath.PNG

 

Thanks in advance,

 

With kind regards,


Cor

 

The table:

InvoicedateInvoicenumberCustomernumberKeywordAmount excl VAT
1-1-20181100A                        10,00
1-1-20182200B                        20,00
1-1-20183300C                        30,00
1-1-20184400D                        40,00
1-2-20185100                         50,00
1-2-20186200                         60,00
1-2-20187300                         70,00
1-2-20188400                         80,00
1-4-20189100K                        90,00
1-4-201810200L                     100,00
1-4-201811300M                     110,00
1-4-201812400N                     120,00
1-5-201813100                      130,00
1-5-201814200                      140,00
1-5-201815300                      150,00
1-5-201816400                      160,00
1-6-201817100Q                     170,00
1-6-201818200R                     180,00
1-6-201819300S                     190,00
1-6-201820400T                     200,00
3 ACCEPTED SOLUTIONS
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous

 

For firstKeyWord

 

Try this Column

 

First KeyWord =
VAR FIRSTNONBLANKKeyWord =
    TOPN (
        1,
        FILTER (
            Table1,
            Table1[Customernumber] = EARLIER ( Table1[Customernumber] )
                && NOT ( ISBLANK ( Table1[Keyword] ) )
        ),
        [Invoicedate], ASC
    )
RETURN
    MINX ( FIRSTNONBLANKKeyWord, [Keyword] )

Regards
Zubair

Please try my custom visuals

View solution in original post

@Anonymous

 

For keyword path you can use this MEASURE

 

Kewwordpath MEASURE =
CONCATENATEX (
    FILTER ( Table1, Table1[Keyword] <> "" ),
    Table1[Keyword],
    ", ",
    [Keyword]
)

Regards
Zubair

Please try my custom visuals

View solution in original post

@Anonymous

 

As a calculated column for KewWord Path...you could use

 

Kewwordpath Column =
CONCATENATEX (
    FILTER (
        Table1,
        Table1[Customernumber] = EARLIER ( Table1[Customernumber] )
            && Table1[Keyword] <> ""
    ),
    Table1[Keyword],
    ", ",
    [Keyword]
)

Regards
Zubair

Please try my custom visuals

View solution in original post

7 REPLIES 7
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous

 

For firstKeyWord

 

Try this Column

 

First KeyWord =
VAR FIRSTNONBLANKKeyWord =
    TOPN (
        1,
        FILTER (
            Table1,
            Table1[Customernumber] = EARLIER ( Table1[Customernumber] )
                && NOT ( ISBLANK ( Table1[Keyword] ) )
        ),
        [Invoicedate], ASC
    )
RETURN
    MINX ( FIRSTNONBLANKKeyWord, [Keyword] )

Regards
Zubair

Please try my custom visuals
Anonymous
Not applicable

@Zubair_Muhammad

 

Very nice, you've solved the first challenge, great! 

@Anonymous

 

For keyword path you can use this MEASURE

 

Kewwordpath MEASURE =
CONCATENATEX (
    FILTER ( Table1, Table1[Keyword] <> "" ),
    Table1[Keyword],
    ", ",
    [Keyword]
)

Regards
Zubair

Please try my custom visuals
Anonymous
Not applicable

@Zubair_Muhammad

 

You did it again, you've solved both challenges! You've helped me a lot, I've got one final question, is it possible to have the keywordpath as a calculated column? If so, I can calculate what the total amount of each path is. 

Anonymous
Not applicable

@Zubair_Muhammad

 

I'm sorry, I saw you're calculated column-solution late, you can ignore my final question.

 

You've helped me a lot, you're a real DAX-master, thank you very much!!! 🙂

@Anonymous

 

Please see attached file


Regards
Zubair

Please try my custom visuals

@Anonymous

 

As a calculated column for KewWord Path...you could use

 

Kewwordpath Column =
CONCATENATEX (
    FILTER (
        Table1,
        Table1[Customernumber] = EARLIER ( Table1[Customernumber] )
            && Table1[Keyword] <> ""
    ),
    Table1[Keyword],
    ", ",
    [Keyword]
)

Regards
Zubair

Please try my custom visuals

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.