Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Dear Power BI community,
I am new to Power BI, and I have a problem with treatas measure when using it to calculate count.
Below is a sample table, "Job":
| ID | Job | Date |
| 101 | Engineer | 18/10/2023 |
| 202 | Salesperson | 19/10/2023 |
| 303 | Teacher | 20/10/2023 |
| 404 | Designer | 21/10/2023 |
| 202 | Manager | 22/10/2023 |
And this is a date table for creating slicer "DateTable":
| Date |
| 18/10/2023 |
| 19/10/2023 |
| 20/10/2023 |
| 21/10/2023 |
| 22/10/2023 |
I want to create a bar chart with "Job" as x-axis, count of "ID" as y-axis, and have "DateTable"'s date as a dropdown slicer that allows only single select. When select the slicer, bar chart will show the count of job with date that is <= SELECTEDVALUE(Date):
And here is the problem, ID 202 was Salesperson at 19/10/2023, and change to Manager at 22/10/2023, but when 22/10/2023 is selected on slicer, Salesperson is still on the bar chart:
The measure I use for counting Job is:
Below is a comparison of the measure in Card, Table, and Bar Chart:
The count of job need to be only once for each ID, and date to be the latest date that is <= SELECTEDVALUE(Date).
I also need the slicer to be a single select dropdown.
There could be more duplicates for each ID with different dates.
Is there a way to make the bar chart to show 4 values without showing "Salesperson", in which ID 202 = Manager when date 22/10/2023 is selected?
Thank you very much.
You need neither TREATAS nor your join when you have a proper data model
You should also disable auto date/time as soon as possible.
Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
If you are unsure how to do that 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.
If you want to get answers faster please refer to https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...