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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
mushir1232
Regular Visitor

CountIf with Sequence Result

Hi All,

Need Assistance in Power Query  to DAX Measure to get the Sequential Count result on Countif.

I have applied : =COUNTIF($A$2:A2,A2)

 

mushir1232_0-1683873282658.png

 

2 REPLIES 2
AlienSx
Super User
Super User

Hi, @mushir1232 you'd probably want to keep sorting order so I added index column before transformation and removed it in the end. 

let
    // Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Source = <your_table>,
    sort_col = Table.AddIndexColumn(Source, "sort", 0, 1, Int64.Type),
    f = (tbl as table) as table => [a = Table.Sort(tbl, "sort"), b = Table.AddIndexColumn(a, "Result", 1, 1, Int64.Type)][b],
    g = Table.Group(sort_col, "Data", {{"all", each f(_)}}),
    all = Table.Combine(g[all]),
    sort_again = Table.Sort(all,{{"sort", Order.Ascending}}),
    remove_sort = Table.RemoveColumns(sort_again,{"sort"})
in
    remove_sort

Hi, thanks for your time to workout.

What I Need a another Column in front of my Data showing the No of Counts . I want to know how many times the item is there in the Column with a sequence.

If A is available in Different Row , in the given sample 4 times, so from the Top the It is counting and checking and providing the No of Counts from the Top always.

Similar to COUNTIF($A$2:A2,A2) in Excel

 

 

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.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

Top Solution Authors
Top Kudoed Authors