Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi Everyone,
I have a requirement to caluclate distinct "ID's" which are having comments and having comments=blanks() for each user.
I have created two measures to caluclate count of ID's for individual users.
Completed = var av= CALCULATE(DISTINCTCOUNT('Table'[ID]),'Table'[Comment]<>BLANK())
How to look the ID's which are having comments in prev rows.
Expected result "0" instead of "2", since for user a products 1&2 having comments in prev dates
Solved! Go to Solution.
Hi @Anonymous ,
I created a sample pbix file(see attachment) for you, please check whether that is what you want.
1. Create a calculated column as below:
Maxdate =
CALCULATE (
MAX ( 'Table'[Date] ),
FILTER (
'Table',
'Table'[User] = EARLIER ( 'Table'[User] )
&& 'Table'[ID] = EARLIER ( 'Table'[ID] )
)
)
2. Create two measures to get the count of completed and incompleted IDs
Completed =
VAR _count =
CALCULATE (
DISTINCTCOUNT ( 'Table'[ID] ),
FILTER (
'Table',
'Table'[Date] = 'Table'[Maxdate]
&& 'Table'[Comment] <> BLANK ()
)
)
RETURN
_count + 0
Incompleted =
VAR _count =
CALCULATE (
DISTINCTCOUNT ( 'Table'[ID] ),
FILTER (
'Table',
'Table'[Date] = 'Table'[Maxdate]
&& 'Table'[Comment] = BLANK ()
)
)
RETURN
_count + 0
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
Hi @Anonymous ,
I created a sample pbix file(see attachment) for you, please check whether that is what you want.
1. Create a calculated column as below:
Maxdate =
CALCULATE (
MAX ( 'Table'[Date] ),
FILTER (
'Table',
'Table'[User] = EARLIER ( 'Table'[User] )
&& 'Table'[ID] = EARLIER ( 'Table'[ID] )
)
)
2. Create two measures to get the count of completed and incompleted IDs
Completed =
VAR _count =
CALCULATE (
DISTINCTCOUNT ( 'Table'[ID] ),
FILTER (
'Table',
'Table'[Date] = 'Table'[Maxdate]
&& 'Table'[Comment] <> BLANK ()
)
)
RETURN
_count + 0
Incompleted =
VAR _count =
CALCULATE (
DISTINCTCOUNT ( 'Table'[ID] ),
FILTER (
'Table',
'Table'[Date] = 'Table'[Maxdate]
&& 'Table'[Comment] = BLANK ()
)
)
RETURN
_count + 0
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
Hi there!
You could try:
CALCULATE( COUNTROW( 'Table' ), 'Table'[Comment] <> BLANK() )
Let me know if that helps!
User | Count |
---|---|
77 | |
75 | |
46 | |
31 | |
28 |
User | Count |
---|---|
99 | |
93 | |
50 | |
49 | |
46 |