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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Mat42
Resolver I
Resolver I

Calculated Column - Latest Entry

I have a dataset that is a mix of quarterly data and annual data. It's similar to the simple example below:

Annotation 2020-02-25 090007.png

 

The 'Current Quarter?' column is a calculated column that I've added that identifies whether the quarter listed in the 'Quarter' column is the period we're currently reporting on. It automatically updates when the next reporting period rolls around. You can see in the example that measures 1 and 3 both have a Y in the 'Current Quarter?' column because the period we're currently reporting on is quarter 3.

 

However, I can't work out how to add the 'Current Year?' column. It needs to identify the latest/most recent entry for a measure and add in a Y, as per the example above. In the example, measures 2 and 4 both have a Y in the most recent entry. An added wrinkle is that the annual data won't necessarily have 4 entries (in the example, measure 2 only has 3).

 

Any ideas?

4 REPLIES 4
V-lianl-msft
Community Support
Community Support

Hi @Mat42 ,

 

Does "measure" have corresponding date?

If so, try the DAX below:

Measure = IF(YEAR(TODAY())=MAX('Table'[Date].[Year]),"Y","N")
If the problem persists,could you please share more sample data or sample pbix?

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for your responses.

 

The problem is that what I've shared is basically all there is. The measures don't have an assigned date, just Q1 Q2 etc or the 2015/2016, 2018-2019 designations. The rest of the table is just service specific data (levels, amounts etc) that match the measure. The example table is the only data not input on a quarterly basis.

 

Is it possible, maybe, to use the Max function to create the column to add a Y to the last entry per annual measure? The quarter labels (Q1 etc) are easy to work with, but the year entries will vary. Sometimes the latest data will be 2019/2020, sometimes it might be 2016/2017. It really just needs to add a Y in for the latest year (for those measures that don't have Q1 etc.

Thanks for everyone's help.

 

Turns out I was trying to do something that we don't actually need to do. Which would have been helpful to know a month ago.

Anyway, thanks for the help.

amitchandak
Super User
Super User

is this your raw data, on which you are working?

Try Like

if(period = (year(today()) &"-"& year(date(year(today()) ,year(today()) -12,day(today()) ))),"Y","N")
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors