Forum Discussion
Unique Count in Row convert
- 6 months ago
Hi Tevon713,
Thank you for the follow-up and for testing the helper-table approach.
The behaviour you are seeing occurs because Power BI measures are always evaluated based on the current filter context, so when a helper table is related back to the fact table, slicers such as Year, Region, or Product still propagate and change the result. This is why the unique count continues to vary (for example 7 instead of 14), even though the logic appears correct.
If your requirement is to count accounts that appear exactly once in the entire dataset and keep that value constant regardless of filters, the uniqueness logic must explicitly ignore report filters. You can achieve this using the following measure, which evaluates uniqueness across the full dataset and removes all filters:Truly Unique Accounts := CALCULATE ( COUNTROWS ( FILTER ( SUMMARIZE ( ALL ( 'Fact' ), 'Fact'[Acct #], "RowCnt", COUNTROWS ( 'Fact' ) ), [RowCnt] = 1 ) ), REMOVEFILTERS ( 'Fact' ) )This measure evaluates uniqueness at the Account # level and will consistently return 14, matching the intent of your original Excel logic, regardless of how the report is filtered.
Thanks again for using the Microsoft Fabric Community Forum.
I have repost with sample excel model.
is your excel formula correct?
=IF(H2=1,"",IF(COUNTIF(F2:F2,F2)=1,1,""))
the expected output is the same as =IF(H2=1,"",1)
could you explain the logic?
- Tevon7137 months agoHelper V
Sorry typo it suppose to lock the first cell then count and seek in column F.
Ideally if I add monthly data then column H doesn't really matter if it just "distinctcounts" column F, how to keep it dynamic across different dimensions based on filter?
=IF(H2=1,"",IF(COUNTIF($F$2:F2,F2)=1,1,""))- ryan_mayu7 months agoSuper User
you can try this.
create an index column in pq
then create a column
Column = if('Table'[Prior Yr Uniq Ct]=1,blank(),if(countx(FILTER('Table','Table'[Index]<=EARLIER('Table'[Index])&&'Table'[Acct #]=EARLIER('Table'[Acct #])),'Table'[Acct #])=1,1,blank()))pls see the attachment below