Calculate variance

Anything related to PowerPivot and DAX Formuale
tahars
Posts: 1
Joined: Tue Aug 27, 2019 1:17 am

Calculate variance

Postby tahars » Tue Aug 27, 2019 2:06 am

Hi there,

I'M a new DAX user, And I'm trying to calculate variance between 2 years than I choose in a selected column.

I've created two measures: one to calculate the sum of the sales (Mesure1 = SUM ('Requête1'[DelNettValue])) and the second is for the sum of sales one year before (Mesure2 = CALCULATE ([Mesure1]; DATEADD ('Requête1'[Date delivery]. [Année]; -1; YEAR))). After that I will make the difference between those two measures on Mesure3 = Mesure1 - Mesure2. However, when I add Mesure2 to the table, an error message appears: "a column specified in the DATEADD function is not of type DATE."

But I've checked the spécific type of the date column and it's DATE.

Could one of you please help me ?

I can't share my file, it's too large even on. zip

Wrencher
Posts: 10
Joined: Thu Jan 19, 2017 2:37 pm

Re: Calculate variance

Postby Wrencher » Tue Aug 27, 2019 3:34 am

Try this as a test...

In the table with the dates, create a new column (calculated column) with the same formula you have in the measure. If you get the same error, the column with the "date", may not be formatted as a recognized date. Then, in a new column, try using the DAX DateValue function to convert it to a date, then run the measure against that column and see if it works. https://docs.microsoft.com/en-us/dax/datevalue-function-dax


Return to “PowerPivot/DAX”

Who is online

Users browsing this forum: No registered users and 0 guests