The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I have this measure that first filters out all rows from a date column that are older than a given date; and then counts the rows in 'Document Key' column.
Under1Year = COUNTX(FILTER('Inventory',[Content Current Date].[Date] >= CONVERT("03/01/2019",DATETIME)),'Inventory'[Document Key])
This was working fine.
Now, there's an additional requirement to count only unique values from that column. I modified the formula as below but none of them worked.
This one gave the same result as the above original formula(which I know is incorrect as there are duplicate values present in the 'Document Key' column after the date filter is applied)
Under1Year = COUNTX(FILTER('Inventory',[Content Current Date].[Date] >= CONVERT("03/01/2019",DATETIME)),DISTINCTCOUNT('Inventory'[Document Key]))
Then I tried this one and, as expected, it threw a runtime error as DSTINCTCOUNT only accepts a column as an argument.
Under1Year = DISTINCTCOUNT(COUNTX(FILTER('Inventory',[Content Current Date].[Date] >= CONVERT("03/01/2019",DATETIME)),'Inventory'[Document Key]))
Any suggestions on how to get this to work?
- Regards
Solved! Go to Solution.
Something like this maybe:
Mdis = CALCULATE(DISTINCTCOUNT(Inventory'[Document Key]), Inventory[[Content Current Date]] >= DATE(2020, 03, 01))
Something like this maybe:
Mdis = CALCULATE(DISTINCTCOUNT(Inventory'[Document Key]), Inventory[[Content Current Date]] >= DATE(2020, 03, 01))
User | Count |
---|---|
27 | |
12 | |
8 | |
8 | |
5 |
User | Count |
---|---|
31 | |
15 | |
12 | |
8 | |
7 |