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 am new to PBI as our company has long since used Qlikview but transitioning to PBI.
I have spent a decent amount of time trying to figure this one out and while I am narrowing in on the answer I am either getting the wrong answer or errors.
I have 4 relebant fields
Worker , Approval Date, Expense ID, Amount
I am using a table and want to show Worker, Sum Amount by Approval Date Year and Distinct Count of Expense ID.
Sum Amount by Year is done.
Count Distinct Expense ID's is my problem= If the Worker has no claims in the Year the Count is 1 not zero.
Any thought that could help? I have tried various add column options and DISTINCYCOUNTNOBLANKS.
Thanks in advance,
Rob
Solved! Go to Solution.
@racer25 You need to create a measure that calculates the distinct count of Expense IDs for each worker and year, and handles cases where there are no claims correctly.
dax
DistinctExpenseCount =
VAR DistinctCount = DISTINCTCOUNT('YourTable'[Expense ID])
RETURN
IF(DistinctCount = BLANK(), 0, DistinctCount)
Proud to be a Super User! |
|
@racer25 You need to create a measure that calculates the distinct count of Expense IDs for each worker and year, and handles cases where there are no claims correctly.
dax
DistinctExpenseCount =
VAR DistinctCount = DISTINCTCOUNT('YourTable'[Expense ID])
RETURN
IF(DistinctCount = BLANK(), 0, DistinctCount)
Proud to be a Super User! |
|
Thanks so much - PBI didn't like the VAR Name of DistinctCount but a quick tweak and working. It also gave me an understanding of how to do it not just copy/[aste - appreciate the support
User | Count |
---|---|
12 | |
9 | |
6 | |
6 | |
5 |
User | Count |
---|---|
24 | |
14 | |
14 | |
9 | |
7 |