Forum Discussion
How to remove duplicates in calculated column?
- 8 years ago
Hi Zain26,
Create measures like below:
Max Count = CALCULATE ( MAX ( 'TimeRange Table'[CountofTimeRange] ), ALLEXCEPT ( 'TimeRange Table', 'TimeRange Table'[USER] ) ) Peak Time Range = CALCULATE ( LASTNONBLANK ( 'TimeRange Table'[TimeRange], 1 ), FILTER ( 'TimeRange Table', 'TimeRange Table'[CountofTimeRange] = [Max Count] ) )
Add field [USER] into Columns area of matrix, and add measure [Peak Time Range] into Values section.
Best regards,
Yuliana Gu
What formula did you use for the column?
- Zain268 years agoAdvocate II
Occurence =
VAR latestDateTime= MAXA('Comments'[Time])
VAR year= YEAR(latestDateTime)
VAR month= MONTH(latestDateTime)
VAR c= CALCULATE(COUNTROWS('Comments'),ALLEXCEPT(Comments,Comments[Intervals],Comments[CommentIdentifier]),Comments[Time].[Date]>=DATE(year,month,1))
return c
Here Intervals is another calculated table where I have defined the time ranges using my Time column.
Basically I want to get the Interval value against max time for each Comment Identifier. But there are duplicates as you can see for Interval 3pm-6pm Occurance is 40, and for 9pm-12am is also 40.- Ashish_Mathur8 years agoSuper User
Hi,
In a spare column, please indicate the values that you are expecting.
- Zain268 years agoAdvocate II
This is how I want my matrix to look like. If you look at the Status Peak , that is how I expect to get the value for CommentP. In simple words I expected to take the most repeated value in the Interval column. Upon to do that I tried this approach of getting count for each [Interval] against the [Comment Identifier]. And then look for the max count and retrieving the corresponding [Interval]- Ashish_Mathur8 years agoSuper User
Hi,
I am still not clear. With respect to the data that you have shared, please show how you want your matrix visual to be (with actual entries in rows/column/values)