Forum Discussion
Show latest data in visual
I have monthly headcount data by department for our company in a table.
I have a KPI visual that shows the headcount for the company as a whole which always shows the headcount for the latest month's data in the table.
I'm trying to create a clustered bar chart visual that shows the headcount for each department but I want it to automatically show the latest month's data as the KPI visual does.
Is there a way to achieve this, maybe with a calculated column?
Hello Fusilier2
Use this measure
Latest Month Headcount =
VAR LatestMonth = MAX('Table'[Month])
RETURN
CALCULATE(SUM('Table'[Headcount]), 'Table'[Month] = LatestMonth)
Thanks,
Pankaj Namekar | LinkedInIf this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.
2 Replies
- pankajnamekar25
Super User
Hello Fusilier2
Use this measure
Latest Month Headcount =
VAR LatestMonth = MAX('Table'[Month])
RETURN
CALCULATE(SUM('Table'[Headcount]), 'Table'[Month] = LatestMonth)
Thanks,
Pankaj Namekar | LinkedInIf this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.
- danextian
Super User
Hi Fusilier2
The solution really depends on how your model is set up. Are you using a separate date or calendar table, or are you working directly with the date column in your fact table? If you're using the latter, it also matters whether your month column is a text value or an actual date. If it's text, we can't rely on something like MAX('Table'[Month]), because it’ll just return the last month alphabetically—not the most recent one chronologically.