Forum Discussion
Distinct CountX Help
- Anonymous2 years ago
HI,maashi
Regarding the issue you raised, my solution is as follows:
1.First I have created the following table and the column names and data are the data you have given:
2. I updated your CountX section to the following measure:
Measure 2 = CALCULATE(DISTINCTCOUNT(fact_NCP_Reporting[Sales Order No]),FILTER('fact_NCP_Reporting','fact_NCP_Reporting'[NCP]="NCP"))3.The output is as follows:
4.All code updates are as follows:
Measure 3 = DIVIDE( CALCULATE( DISTINCTCOUNT( fact_NCP_Reporting[Sales Order No]), FILTER('fact_NCP_Reporting', 'fact_NCP_Reporting'[NCP]="NCP")) , ( SUMX( FILTER( fact_NCP_Reporting, fact_NCP_Reporting[NCP]="Sales Order" ), fact_NCP_Reporting[SQM] ) /1000 ) )5.The results of this section are as follows:
6.With your date column requirements, my metrics are updated as follows:
Measure 4 = DIVIDE( CALCULATE( DISTINCTCOUNT( fact_NCP_Reporting[Sales Order No]), FILTER(ALLSELECTED('fact_NCP_Reporting'), 'fact_NCP_Reporting'[NCP]="NCP"&&'fact_NCP_Reporting'[month]=MAX('fact_NCP_Reporting'[month]))) , ( SUMX( FILTER( ALLSELECTED(fact_NCP_Reporting), fact_NCP_Reporting[NCP]="Sales Order"&&'fact_NCP_Reporting'[month]=MAX('fact_NCP_Reporting'[month]) ), fact_NCP_Reporting[SQM] ) /1000 ) )7.The end result is as follows:
Please find the attached pbix relevant to the case.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
HI,maashi
Regarding the issue you raised, my solution is as follows:
1.First I have created the following table and the column names and data are the data you have given:
2. I updated your CountX section to the following measure:
Measure 2 = CALCULATE(DISTINCTCOUNT(fact_NCP_Reporting[Sales Order No]),FILTER('fact_NCP_Reporting','fact_NCP_Reporting'[NCP]="NCP"))
3.The output is as follows:
4.All code updates are as follows:
Measure 3 = DIVIDE(
CALCULATE(
DISTINCTCOUNT(
fact_NCP_Reporting[Sales Order No]),
FILTER('fact_NCP_Reporting',
'fact_NCP_Reporting'[NCP]="NCP"))
,
(
SUMX(
FILTER(
fact_NCP_Reporting,
fact_NCP_Reporting[NCP]="Sales Order"
),
fact_NCP_Reporting[SQM]
)
/1000
)
)
5.The results of this section are as follows:
6.With your date column requirements, my metrics are updated as follows:
Measure 4 =
DIVIDE(
CALCULATE(
DISTINCTCOUNT(
fact_NCP_Reporting[Sales Order No]),
FILTER(ALLSELECTED('fact_NCP_Reporting'),
'fact_NCP_Reporting'[NCP]="NCP"&&'fact_NCP_Reporting'[month]=MAX('fact_NCP_Reporting'[month])))
,
(
SUMX(
FILTER(
ALLSELECTED(fact_NCP_Reporting),
fact_NCP_Reporting[NCP]="Sales Order"&&'fact_NCP_Reporting'[month]=MAX('fact_NCP_Reporting'[month])
),
fact_NCP_Reporting[SQM]
)
/1000
)
)
7.The end result is as follows:
Please find the attached pbix relevant to the case.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.