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
Anonymous
Not applicable

Calculated column for a value for next 6 days

 

I am facing an issue with calculated column.

Anis_Hussain_1-1680239829856.png

 

This is sample data and here I want to achieve if isStoreClosed is Closed Status then I want to divide the Daily_Split Value by 6 and add this average value to the next 6 Retail Dates Daily_Split Value.

I have created the Daily_Split2 Column and written the folloing dax to achieve the result

Daily_split 2 =
VAR Closed =
    CALCULATE (
        SUM ( 'Daily Table'[Daily_Split] ) / 6,
        FILTER (
            'Daily Table',
            'Daily Table'[IsStoreClosed] = "Closed"
                && 'Daily Table'[Store_Code] = EARLIER ( 'Daily Table'[Store_Code] )
                && 'Daily Table'[Retail Date] = EARLIER ( 'Daily Table'[Retail Date])
                && 'Daily Table'[Iteration] = EARLIER('Daily Table'[Iteration])
                && 'Daily Table'[Category]EARLIER('Daily Table'[Category])))

   return
   
    IF (
        'Daily Table'[IsStoreClosed] = "Open",
        CALCULATE (
            SUM('Daily Table'[Daily_Split])+ Closed,
            FILTER (
                'Daily Table',
                'Daily Table'[Store_Code] = EARLIER('Daily Table'[Store_Code])
                && 'Daily Table'[Retail Date] >= EARLIER('Daily Table'[Retail Date])
                && 'Daily Table'[Retail Date] <= EARLIER('Daily Table'[Retail Date]) + 6
                && 'Daily Table'[Iteration] = EARLIER('Daily Table'[Iteration])
                && 'Daily Table'[Category]=EARLIER('Daily Table'[Category])

                   
            )
        ))

But this Code not giving me the desired result. I am not able to add the average value to the next 6 days.
How do I fix this any help please.
2 REPLIES 2
Anonymous
Not applicable

@lbendlin I have got the DAX part and the problem is solved now. Thanks for your message.

lbendlin
Super User
Super User

Next six days from what?  The row context?  The "current"  date (whatever that is)?  Is your data source in import mode?

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.