Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
smmoore34
Helper III
Helper III

Create a measure that refers to a specific field in a column

I have  the following table with (2 columns)

Year   # Incidents

2022  98756

2023  12354

2024   64789

 

The  year is linked to my other tables. When I filter on year I want to have a measure to use in a card that shows the # incidents in that year. 

1 ACCEPTED SOLUTION
Kaviraj11
Super User
Super User

Total Incidence = 

var _selecteddate=FIRSTDATE('Calendar'[Date])
return CALCULATE(SUM(Tablename[# Incidents])+0,TREATAS({_selecteddate},'Calendar'[Date]))



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

4 REPLIES 4
Kaviraj11
Super User
Super User

Can you share the PBIX File?

I need more details to understand the data type as well. Please elaborate it




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





I beleive I have figured this out. Thank you for your assistance, I'll accept your first solution.

Kaviraj11
Super User
Super User

Total Incidence = 

var _selecteddate=FIRSTDATE('Calendar'[Date])
return CALCULATE(SUM(Tablename[# Incidents])+0,TREATAS({_selecteddate},'Calendar'[Date]))



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





I'm not clear on what to enter for the Calendar'[Date]).

My "main_table" has a column called 'Year' which is extracted from a Date field in this table. 

This 'year' column is linked to my table called "incident_counts" that has the following columns:

Year   # Incidents

2022  98756

2023  12354

2024   64789

If the data is filtered on the year 2022 for example, I want a measure that will return the value of '98756'.

 

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors