Forum Discussion
Count/sum without duplicate rows and define which row is accurate
- Anonymous4 years ago
Hi codyraptor ,
Please refer to my pbix file to see if it helps you. I also use Direct Query mode.
Create measures.
Measure 1 = IF(SELECTEDVALUE('table$'[STATUS])="Open",1,0)Measure_2 = VAR maxx_ = MAXX ( ALLEXCEPT ( 'table$', 'table$'[ID] ), [Measure 1] ) RETURN IF ( maxx_ = 1, "OPEN", SELECTEDVALUE ( 'table$'[STATUS] ) )Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Here's a sample of data... My issue is...I want to show the correct grouping for 'Status'. If a dispID has an open status...I want the entire disp to = Open. My counts below should show 2 Open and 1 Cxl.
| ID | Status |
| 123 | CXL |
| 123 | Open |
| 124 | Open |
| 125 | CXL |
| 125 | CXL |
I know how to do this by creating a calculated column. However, I'm trying to make use of an agg table using a composite model and DQ doesn't allow these types of calculations to take place. I either have to do it in 'M'...or create seperate Agg tables...etc.. In a perfect world...I would want to create my table like the following with the added ID level status..
| ID | ID Lvl Status | Status |
| 123 | Open | CXL |
| 123 | Open | Open |
| 124 | Open | Open |
| 125 | Cxl | CXL |
| 125 | Cxl | CXL |
Hi codyraptor ,
Please refer to my pbix file to see if it helps you. I also use Direct Query mode.
Create measures.
Measure 1 = IF(SELECTEDVALUE('table$'[STATUS])="Open",1,0)Measure_2 =
VAR maxx_ =
MAXX ( ALLEXCEPT ( 'table$', 'table$'[ID] ), [Measure 1] )
RETURN
IF ( maxx_ = 1, "OPEN", SELECTEDVALUE ( 'table$'[STATUS] ) )
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.