Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Dax query to calculate YTD based on Yearly total IDs not based on latest or selected Month ID's
for example :
Jan 24 have 200 Agents
Feb 24 have 230 Agents
Mar 24 have 210 Agents
so when we calculate YTD it should segregate agents not only based on Mar 210 it should consider all distinct agents across the year .
i tried creating composite key use agent and month year but this gives output based on Mar 24 agents not overall distinct agents .
pls let me know if any solution
its not working for me .
Hi @Dilip7 ,
Could you please provide some raw data in your tables(exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following link to share the required info:
How to provide sample data in the Power BI Forum
And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
Hi @Dilip7 - you need to ensure that the calculation considers all agents across all months up to the current month
measure eg. as follow
YTD Distinct Agents =
VAR CurrentYear = YEAR(MAX('Table'[Date]))
RETURN
CALCULATE(
DISTINCTCOUNT('Table'[AgentID]),
FILTER(
ALL('Table'),
YEAR('Table'[Date]) = CurrentYear &&
'Table'[Date] <= MAX('Table'[Date])
)
)
check the above and let know.
Proud to be a Super User! | |
Please check and give a confirmation, Thank you!
Proud to be a Super User! | |
User | Count |
---|---|
84 | |
76 | |
75 | |
43 | |
36 |
User | Count |
---|---|
109 | |
56 | |
52 | |
48 | |
43 |