Forum Discussion
ohnothimagain
Helper I
2 years agoDAX- Addcolumn and Count with simple condition
Hello everyone, I'm completly stuck in this problem,wish anyone can give me a solution...(maybe easy) I have a table below,and want to count [PN]numbers only adapted distinct [PO] counts over 2. t...
- 2 years ago
Thanks for testing this, and sorry for my typo! 😅
You're exactly right, the measure should be
test91 := VAR PN_PO = SUMMARIZE ( 'TEST_', 'TEST_'[PN], 'TEST_'[PO] ) VAR PN_PO_Count = GROUPBY ( PN_PO, 'TEST_'[PN], "@PO_Count", SUMX ( CURRENTGROUP (), 1 ) ) VAR PN_Filtered = FILTER ( PN_PO_COUNT, [@PO_Count] > 2 ) VAR Result = COUNTROWS ( PN_Filtered ) RETURN ResultDoes that work as intended?
OwenAuger
Super User
2 years agoThanks for testing this, and sorry for my typo! 😅
You're exactly right, the measure should be
test91 :=
VAR PN_PO =
SUMMARIZE ( 'TEST_', 'TEST_'[PN], 'TEST_'[PO] )
VAR PN_PO_Count =
GROUPBY ( PN_PO, 'TEST_'[PN], "@PO_Count", SUMX ( CURRENTGROUP (), 1 ) )
VAR PN_Filtered =
FILTER ( PN_PO_COUNT, [@PO_Count] > 2 )
VAR Result =
COUNTROWS ( PN_Filtered )
RETURN
Result
Does that work as intended?
- ohnothimagain2 years ago
Helper I
Yes! it worked that I wanted it to be.thank you so much! It was really hard for me to solve by myself!