Forum Discussion
Display unique items that appeared each year
- 7 years ago
Anonymous
Try this revision
Distinct Count With Totals = IF ( HASONEFILTER ( tblData[Item Appearance Date (Year) 1] ) && HASONEFILTER ( tblData[CHAR DESCRIPTION] ) && HASONEFILTER ( [CHAR VALUE] ), [DistinctCount], SUMX ( SUMMARIZE ( tblData, [Item Appearance Date (Year) 1], [CHAR DESCRIPTION], [CHAR VALUE] ), [DistinctCount] ) )
Hi Anonymous,
Can you show up the expected result based on your data in your first post, please? I can't find out the logic here because I don't know what it should be for "LSDM", including XXXX, HHHH, SSSS.
"They should be unique across entire daterange", why the XXXX is counted every year?
The PowerPivot in Excel and the Power BI are almost the same. You can use it directly.
Can you modify my demo to show up what the result should be?
Best Regards,
Dale
Hi Dale ( v-jiascu-msft ),
Apologies if my sample data was not clear or correct as i randomly created it. Here is a clearer example. See the Characteristic Values that i have colored using Conditional Formatting. Each appears only once during entire Daterange. These i would call "Emerging" Characteristics. The rest that are repeating every year, i would call "Trending" Characteristics.
Attaching the Sample Data for your inspection which has Pivots conditional formatted on Characteristic Values column.
Also if you can please refer my Notes section for the remaining questions and guide me how they can be answered using Pivot & DAX.
Thanks.
- Zubair_Muhammad7 years ago
Community Champion
Anonymous
Give this a shot
DistinctCount = IF ( CALCULATE ( COUNT ( tblData[CHAR VALUE] ), ALL ( tblData[Item Appearance Date (Year) 1], tblData[CHAR DESCRIPTION] ) ) = COUNT ( tblData[CHAR VALUE] ), 1 )- Zubair_Muhammad7 years ago
Community Champion
Anonymous
If you want the Grand Total as well
You will have to add this Additional measure as well
Please see your file attached
DistinctCount with Totals = IF ( HASONEFILTER ( tblData[Item Appearance Date (Year) 1] ), [DistinctCount], SUMX ( SUMMARIZE ( tblData, [Item Appearance Date (Year) 1], [CHAR DESCRIPTION], [CHAR VALUE] ), [DistinctCount] ) )- Anonymous7 years agoNot applicable
Zubair_Muhammad getting Errors on both formulae:
DISTINCTCOUNT: Semantic error: The function COUNT takes an argument that evaluates to numbers or dates and cannot work with Values of type strings. DISTINCT COUNT WITH TOTALS: Semantic error: Dependency error in the measure.
What could be wrong here? is it the format of the dates?