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 September 15. Request your voucher.
I have the following case, which turned out quite a difficult task. I have a table with employee number and the last date the employee was active. Additionally i have a calendar table. They have a 1:many relationship.
What i would like to do is create a chart where each employee is counted once for the maximum date where he was active.
If i have 3 people where the last actove date was 6/1/2024 on the column chart it will count 3. Each previous date when they were active should be ignored.
It should basically look like this:
I tried different things, the last thing i tried after some consultation was the following code:
Employee max =
VAR __tbl =
FILTER(CALCULATETABLE(
ADDCOLUMNS(
SUMMARIZE('Table', 'Table'[PersonId], 'Calendar'[Date]), "distinct", [Employee]),
REMOVEFILTERS( 'Calendar'[Date], 'Calendar'[MonthnYear] )), NOT ISBLANK([distinct]))
VAR __last_date_tbl = SELECTCOLUMNS(GROUPBY(__tbl, [PersonId], "zzz", MAXX(CURRENTGROUP(), 'Calendar'[Date])), "dates", [zzz])
RETURN
IF(MAX('Calendar'[Date]) IN __last_date_tbl,
CALCULATE([Employee]
, Calendar[Date] = MAX('Calendar'[Date]) --__something
))
It generally works, if i have a single moth selected on the slicer on the page, but if i expand the selection to 2 or 3 months it couns the employee based on the last date he was active for each month. I want it to be counted on the last date for the selected period as a whole. What am i missing that makes the count by month, how can i ignore it?
Thank you!
You need to disconnect the calendar table and use measures.
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information or anything not related to the issue or question.
If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...
User | Count |
---|---|
15 | |
12 | |
8 | |
7 | |
7 |
User | Count |
---|---|
24 | |
20 | |
12 | |
10 | |
7 |