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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
smmoore34
Helper I
Helper I

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
Resolver III
Resolver III

Total Incidence = 

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

View solution in original post

4 REPLIES 4
Kaviraj11
Resolver III
Resolver III

Can you share the PBIX File?

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

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

Kaviraj11
Resolver III
Resolver III

Total Incidence = 

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

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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