Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

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
  • 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.

4 Replies

  • Anonymous's avatar
    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!

    • Greg_Deckler's avatar
      Greg_Deckler
      Icon for Community Champion rankCommunity Champion

      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.

      • Anonymous's avatar
        Anonymous
        Not applicable

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

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    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])