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
Anonymous
Not applicable

Wierd behaviour with Powerbi and datediff

Hi,

 

I have a report with the following measure

 

DaysPast = DATEDIFF (INVOICE[INVOICE_DATE], TODAY (),DAY
 
This works fine.. however in my new report.. based on the same data it does not recognise any table columns... how is this possible?
 
Thanks
 
Chris
1 ACCEPTED SOLUTION

@Anonymous When using measures, references to columns have to include an aggregation function like SUM, MIN, MAX, etc. This is a big difference from calculated columns. Calculated columns have row context and so do not need aggregation functions to reference other columns because the default is to get the value in the column for the same row.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

@Greg_Deckler 

 

Both are imports -  one is from a odbc connection to a database.. the other is from an excel table.

 

In the end I made it a calculated column.. strange behaviour though!

@Anonymous When using measures, references to columns have to include an aggregation function like SUM, MIN, MAX, etc. This is a big difference from calculated columns. Calculated columns have row context and so do not need aggregation functions to reference other columns because the default is to get the value in the column for the same row.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

My error - was initially a calculated column.. been a long day

Greg_Deckler
Super User
Super User

@Anonymous So is this via a Live connection to the dataset or Direct query for Power BI datasets or are they both import models? Also, if this is really a measure and not a calculated column, you should need an aggregation function around the column reference (INVOICE[INVOICE_DATE])


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.