The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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!