cancel
Showing results for
Did you mean:

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

New Member

## Fields not appear in new measure

Help..

I have column named "Driver_Card_Expiry_Date". I tried to use New Measure.

Months Left = DATEDIFF ([Today Date], ________________, MONTH)

The column I want won't appear. Please help tp solve. I've been at it for half a day.

Thanks.

2 ACCEPTED SOLUTIONS
Resident Rockstar

You can't use the column as a reference in measure since measure expects and returns a single value.

Use LASTDATE() DAX function. it will take last non-blank date and calculate month difference.

E.g,

Months Left = DATEDIFF ([Today Date], LASTDATE(Driver_Card_Expiry_Date), MONTH)

New Member

Thanks Siva,

It took me my whole morning to learn about that. I just found the 5 golden rules for DAX Measures, and no.2 is No Naked Column.

I understood that and use the Calculated Columns instead. And voilaa..!  It works.

MONTHS LEFT = DATEDIFF(TODAY(), DRIVER[Date Expire].[Date], MONTH)

Thanks for your input Siva !

2 REPLIES 2
Resident Rockstar

You can't use the column as a reference in measure since measure expects and returns a single value.

Use LASTDATE() DAX function. it will take last non-blank date and calculate month difference.

E.g,

Months Left = DATEDIFF ([Today Date], LASTDATE(Driver_Card_Expiry_Date), MONTH)

New Member

Thanks Siva,

It took me my whole morning to learn about that. I just found the 5 golden rules for DAX Measures, and no.2 is No Naked Column.

I understood that and use the Calculated Columns instead. And voilaa..!  It works.

MONTHS LEFT = DATEDIFF(TODAY(), DRIVER[Date Expire].[Date], MONTH)

Thanks for your input Siva !

Announcements

#### Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

#### Power BI Monthly Update - February 2024

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

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors