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

Running count unique flag

Hi Guys,

 

I am new to PBI and need your help, I want to create a flag for unique workorder numbers, It is like creating a Rank for each Wonum. The senario and sample data below, Can you please help on this 

 

WonumRunning-CountWo Uniquie Flag
123411
123420
123430
123440
789611
789620

 

Wonum is what I have, A single wonum can be assigned to multiple peoples, I want to create a flag WO unique flag 1/0 for every wonum. Expected output is Wo Uniquie flag. PS: I don't have Running-Count calculated, I only have wonum from which I want tp derive flag. Thanks for your help

2 ACCEPTED SOLUTIONS

Hi,

1. Add a index column from Edit queries tab

2. Add a Rank column 

Rank = calculate(COUNTROWS(Table1),(FILTER(Table1, EARLIER(Table1[Index])>=Table1[Index])),Table1[Wonum]=EARLIER(Table1[Wonum]))

 

Replace Table1 as appropriate 

rank.JPG

 

 

 

View solution in original post

I have opened  Data View

created New Column from Modelling Tab. I have tried with Text data for Wonum And it is working fine.

Try to create the column with one filter on index and see if it works. Then add the second one.

revised.JPG

View solution in original post

9 REPLIES 9
Anonymous
Not applicable


@Anonymous wrote:

 

 

Wonum is what I have, A single wonum can be assigned to multiple peoples, I want to create a flag WO unique flag 1/0 for every wonum. Expected output is Wo Uniquie flag. PS: I don't have Running-Count calculated, I only have wonum from which I want tp derive flag. Thanks for your help



Hi Movva

  But , your sample data doesnt have the people, its simply assiging 1 for each unique WO and 0 for the duplicates. Is it that you want? If not , please share proper sample data with clear expected output.

 

Thanks

Raj

 

Anonymous
Not applicable

Hi Raj, Please find the sample data and output I am looking for below, my plan after struggling a lot today was to create a flag for unique WO..as posted the link requesting for possible way to achieve it. Can you please help me.. So tha sample data and the output I am looking for is below, I have already got woassigned flag created at the backend. I don't have running - count, Wo Uniquie Flag, and the calculation for sum(Job duration). PLEASE HELP

 

WonumJobDuraintwoassigned flagEngineerRunning-CountWo Uniquie Flag
123451Sandeep11
123451Greg20
123451Raj30
123451Kevin40
7896101Tom11
7896101Sam20
7654501Rahul11
7654500Sandeep10
      
Output     
Sum(Jobduration) for each distinct WO where woassigned =1wonum    
51234    
107896    
507654    
Anonymous
Not applicable

Any help on this please? is this possible?

Hi,

1. Add a index column from Edit queries tab

2. Add a Rank column 

Rank = calculate(COUNTROWS(Table1),(FILTER(Table1, EARLIER(Table1[Index])>=Table1[Index])),Table1[Wonum]=EARLIER(Table1[Wonum]))

 

Replace Table1 as appropriate 

rank.JPG

 

 

 

Anonymous
Not applicable

Can I know what do you mean by "Replace Table1 as appropriate" please?

in the formula "Table1" should be replaced with the name of the Table used by you

Anonymous
Not applicable

Hi, I have created Index column, But when I try to creaate a measure it throws me an below error,

"EARLIER/EARLIEST refers to an earlier row context which doesn't exist."

I tried to create Custom Column in edit quieries but again it throws below error

"Expression.Error: The name 'CALCULATE' wasn't recognized.  Make sure it's spelled correctly."

I tried to create New Column and it throws me below error

"DAX don't support comparing values of type integer with values type of text..."

 

Can you let me know what I am doing wrong please, I also tried to use format without much success

 

 

 

Anonymous
Not applicable

My WONUM is text data type... It will be like MJ12345, I tried to change the data type but it still throws the same error

I have opened  Data View

created New Column from Modelling Tab. I have tried with Text data for Wonum And it is working fine.

Try to create the column with one filter on index and see if it works. Then add the second one.

revised.JPG

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.