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
UncleLewis
Helper V
Helper V

DAX INDEX Function Returns Null

Hi all,

I'm working through this video tutorial from SQLBI on Window Functions - I'm at 16:52 in the video.
I'm trying to get the base year sales to compare to all subsequent years, only that my DAX Formula is returning nulls for the base year.

Do you see anything I am doing incorrectly?

Thanks

DAX Studio:
EVALUATE
SUMMARIZECOLUMNS (
    'Product'[BrandName],
    'Calendar'[Year],
    "Sales Amount",[Sales Amount],
    "Sales First Year",
        CALCULATE(
            [Sales Amount],
            INDEX(
                1,
                ALLSELECTED('Calendar'[Year] ),
                ORDERBY( 'Calendar'[Year] )
            )
        )
    )

Results:

ds_index_1.png
 

2 REPLIES 2
Ahmedx
Super User
Super User

plse try this

DAX Studio:
 EVALUATE
SUMMARIZECOLUMNS (
    'Product'[BrandName],
    'Calendar'[Year],
    "Sales Amount",[Sales Amount],
    "Sales First Year",
        CALCULATE(
            [Sales Amount],
            INDEX(
                1, SUMMARIZE (ALLSELECTED('Product'),Product'[BrandName],'Calendar'[Year] ),
                ORDERBY( 'Calendar'[Year] )
            )
        )
    )
cpearson
Resolver I
Resolver I

This is a bit of a lazy reply as I've not looked at the video but your Year looks like it's formatted as a number (with the comma) rather than a date component could that be it?

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.