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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Amitkr174
Helper III
Helper III

Count on the basis of string

Hi @amitchandak  @Mahesh0016  @JihwanKim  @Greg_Deckler @Ajendra  @ThxAlot 

I have a table as below. I need to count the orders and then provide the output as per below table. I want to count the orders and put it in the Occurence band, like if order is >3 and it was requeted by one 1 user, then output should be ">3 orders - 1"

I want a calculated column so that I can create a Graph. Please help on this. 

Row LabelsCount of Orders
Vikas Behel5
TIKENDRA SINGH2
Matthew Jackson2
Martin Bonnor2
Jake Mendoza2
George Rose2
Sarah Liao2
John Gehrung2
Joshua Zelman2
Aaron Johnson2
Clement Quek1
Peter Hansen1
Simeon Strang1
Jeremy Willmott1

 

Output 
>3 Orders1
2 Orders9
1 order4
1 ACCEPTED SOLUTION

@Amitkr174 

Segmants is a new disconnect table. You can insert manually or use my proposed DAX to create a new calculated table
Please refer to the sample PBIX file that is attached in my original reply for more details. 

View solution in original post

5 REPLIES 5
ThxAlot
Super User
Super User

A typical, straightforward size-based cohort.

A generic PQ solution

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Tc7dSsNAEAXgVxn2ujcKPkCrkjba0jaiYOjFYA/dJbszMLtB9OmNKaS5/eD8tK17Dx1nWsEjuoV7cKdF6942L8+7p+OSms2uWg98P/KWS/H4ppq/uqwycytBaKUiapPW3IG2kLP+8oQV1C6go2ZM1rCxp9fAesuqF6rgrZfLDLPvmT4RE9/Gl2wq9B+YX3qMSJBChx7dgHcj7lFgtGbJkAmbkDAUNMV43LpqDUP6oY8QY9JSrn76Aw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Row Labels" = _t, #"Count of Orders" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Row Labels", type text}, {"Count of Orders", Int64.Type}}),

    #"Sorted List" = List.Sort(List.Distinct(#"Changed Type"[Count of Orders])),
    Threshold = #"Sorted List"{1}?,
    #"Joined Tables" = Table.NestedJoin(Table.FromList(List.RemoveLastN(#"Sorted List",1),Splitter.SplitByNothing(),{"Count of Orders"}), "Count of Orders", #"Changed Type", "Count of Orders", "Cnt", JoinKind.FullOuter),
    #"Transformed Columns" = Table.TransformColumns(#"Joined Tables", {{"Count of Orders", each _ ?? ">=" & Text.From(Threshold)}, {"Cnt", Table.RowCount}})
in
    #"Transformed Columns"

ThxAlot_0-1684596494455.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



Amitkr174
Helper III
Helper III

@tamerj1  I am getting the below error. Please advise

 

Amitkr174_0-1684331042614.png

 

I have created a Return Requestor colum. DAX is below:-

Amitkr174_1-1684331086347.png

DAX:- 

IF(

COUNTX (

    FILTER (Table, EARLIER ( Table[Requestor_FullName] ) = Table[Requestor_FullName] ),

    Table[Requestor_FullName]

)>3,">3 Request",

IF(

COUNTX (

    FILTER (Table, EARLIER ( Table[Requestor_FullName] ) = Table[Requestor_FullName] ),

    Table[Requestor_FullName]

)=3,"3 Request",

IF(

COUNTX (

    FILTER (Table, EARLIER ( Table[Requestor_FullName] ) = Table[Requestor_FullName] ),

    Table[Requestor_FullName]

)=2,"2 Request", "1 Request"))))

 

@Amitkr174 

Segmants is a new disconnect table. You can insert manually or use my proposed DAX to create a new calculated table
Please refer to the sample PBIX file that is attached in my original reply for more details. 

Thanks a lot, that is working fine.

tamerj1
Super User
Super User

Hi @Amitkr174 
Please refer to attached sample file wit the proposed soltion.

First you need to manually create the semants table

1.png

then use the following measure

2.png

# Customers = 
SUMX (
    GROUPBY (
        FILTER (
            ADDCOLUMNS ( 
                CROSSJOIN ( 
                    VALUES ( 'Table'[Customer] ),
                    Segmants
                ),
                "@NumOfOrders", [Count of Orders]
            ),
            [@NumOfOrders] > Segmants[Low Limit]
                && [@NumOfOrders] <= Segmants[High Limit]
        ),
        [@NumOfOrders],
        "@Count", SUMX ( CURRENTGROUP ( ), 1 )
    ),
    [@Count]
)

 

 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.