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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

TRICY - DAX Measure Error

Hi Experts

 

I cannot work out why the following correlation Coefficent measure are going wrong - All my other Correlation Coeffient Measure work just Fine the following one the sample file - It not having it.

Measure

RME-FAME0 Spread/Soybean Oil 90-Day Rolling = 
VAR NumberOfDays = 90
VAR MaxWorkingDay = MAX ( 'Dimdate'[Working Day Number] )
VAR MinWorkingDay = MaxWorkingDay - ( NumberOfDays - 1 )
VAR DimdatesToUse = 
    FILTER (
        ALL ( 'Dimdate' ),
        AND (
            'Dimdate'[Working Day Number] <= MaxWorkingDay,
            'Dimdate'[Working Day Number] >= MinWorkingDay
        )
    )
VAR Result = 
    CALCULATE (
        DIVIDE ( [Correlation Coefficent 7], NumberOfDays ),
        DimdatesToUse
    )
RETURN
    Result*90

 

Error Message

BlueWhite111_0-1679846291737.png

 

 

Sample File - Data
https://www.dropbox.com/s/vzt3cqk5w9x5b3m/TestData.pbix?dl=0 

6 REPLIES 6
v-yueyunzh-msft
Community Support
Community Support

Hi , @Anonymous 

Thanks for your sample data you provide. The dax code for this [Correlation Coefficent 7] seems a measure.

You can try to use this code:

RME-FAME0 Spread/Soybean Oil 90-Day Rolling 2 = 
VAR NumberOfDays = 90
VAR MaxWorkingDay = MAX ( 'Dimdate'[Working Day Number] )
VAR MinWorkingDay = MaxWorkingDay - ( NumberOfDays - 1 )
VAR DimdatesToUse =
FILTER (
ALL ( 'Dimdate' ),
AND (
'Dimdate'[Working Day Number] <= MaxWorkingDay,
'Dimdate'[Working Day Number] >= MinWorkingDay
)
)
VAR CorrelationCoeff = [Correlation Coefficent 7]
VAR Result =
CALCULATE (
DIVIDE ( CorrelationCoeff, NumberOfDays ),
DimdatesToUse
)
RETURN
Result * 90

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

 

Anonymous
Not applicable

Hi Aniya - can you kindly provide PBIX - slightly confused here. Thanks

Hi, @Anonymous 

I just modify the dax here in your measure:

vyueyunzhmsft_0-1679998907552.png

This can resovle the issue , but it put in the visual it will return null due to the [Correlation Coefficent 7] returns null in this visual , you need to check this measures's logic when the filter context is put in this visual.

vyueyunzhmsft_1-1679998999336.png

 

 

Best Regards,

Aniya Zhang

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

Anonymous
Not applicable

Error Message}

BlueWhite111_0-1680011028077.png

 

Anonymous
Not applicable

Hi Aniya the measure errors when you add the measure to a standard table based on the date coming from BIODIESEL table

 

this is my final measure

FAME0 90-Day Volatility STDev = CALCULATE([RME-FAME0 Spread/Soybean Oil 90-Day Rolling 2], Window(94,ABS,0,REL, ALLSELECTED('DimDate'[Date]) , ORDERBY('DimDate'[Date],asc)))

 

Anonymous
Not applicable

Hi Support 

 

Is your code a calculated column measure?

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.