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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Purni55
New Member

Need to pull data from one column value with filter in another column value

I have three columns values say GrossSalesCY, EventDate and LastYearCorrespondingDate. Now, I have to create a new column called GrossSalesLY by getting the value from GrossSalesCY where LastYearCorrespondingDate = EventDate. 

 

Can someone please help with Dax?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @Purni55 

Sorry for being so late to get back to you. Something might be missing from your Power BI Desktop. I'll send you the PBIX file, you can open it and see if there's anything wrong with the function. If you still have the above issues, I recommend that you upgrade your Power BI Desktop or reinstall it.

In PBIX, I've added a new measure, here is the DAX and preview:

GrossSalesLY Measure = 
CALCULATE(
    SUM('Table'[GrossSalesCY]),
    FILTER(
        ALL('Table'),
        'Table'[LastYearCorrespondingDate] = MAX('Table'[EventDate])
    )
)

vyohuamsft_0-1715065629015.png

 

 

How to Get Your Question Answered Quickly 

Best Regards

Yongkang Hua

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

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi, @Purni55 
Based on your information, I create a table:

vyohuamsft_0-1714705299431.png

 

Maybe you can create a new column and try the following DAX:

GrossSalesLY = 
CALCULATE(
    SUM('Table'[GrossSalesCY]),
    FILTER(
        ALL('Table'),
        'Table'[LastYearCorrespondingDate] = EARLIER('Table'[EventDate])
    )
)

Here is my preview:

 

vyohuamsft_1-1714705313655.png

 

How to Get Your Question Answered Quickly 

Best Regards

Yongkang Hua

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

 

Hi There, Thanks for the response. Yes I am looking for the same output. I have tried your DAX but it doesn't work with calculated column and throws error Calculate is not a function. 

 

Purni55_0-1714742260949.png

I have tried creating a Calculated Measure instead with same DAX but doesn't satisfy the output. Can you please provide me DAX for Calculated Measure?

 

Thanks

Anonymous
Not applicable

Hi, @Purni55 

Sorry for being so late to get back to you. Something might be missing from your Power BI Desktop. I'll send you the PBIX file, you can open it and see if there's anything wrong with the function. If you still have the above issues, I recommend that you upgrade your Power BI Desktop or reinstall it.

In PBIX, I've added a new measure, here is the DAX and preview:

GrossSalesLY Measure = 
CALCULATE(
    SUM('Table'[GrossSalesCY]),
    FILTER(
        ALL('Table'),
        'Table'[LastYearCorrespondingDate] = MAX('Table'[EventDate])
    )
)

vyohuamsft_0-1715065629015.png

 

 

How to Get Your Question Answered Quickly 

Best Regards

Yongkang Hua

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

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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