Forum Discussion

Amp_'s avatar
Amp_
Frequent Visitor
7 years ago
Solved

Need help with DAX (Month)

Hey! everyone

 

I would like to show 2 month which composed of current month and next month

but i have  begining Value only current month so I would like to cal ending inventory of current month  to be begining of next month

I really appreciate your help on this, thank you in advance.

Please let me know if you need more details on above scenario.

 

  • Hi Amp_ ,

     

    At first, you need to create a new column.

    Rank =
    RANKX ( 'Table', 'Table'[Date],, ASC, DENSE )
    

    Then create your “Ending Inventory” column based on it.

    End =
    CALCULATE (
        MIN ( 'Table'[Begin] ),
        FILTER (
            'Table',
            'Table'[Rank]
                = EARLIER ( 'Table'[Rank] ) + 1
                && 'Table'[Name] = EARLIER ( 'Table'[Name] )
        )
    )
    

    Here is the result.

     

    Best Regards,

    Eads

     

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

2 Replies

  • Ani1991's avatar
    Ani1991
    Icon for Resolver III rankResolver III

    Hi Amp_ 

    It would be very helpful if you could share the required output. 
    From what I understood, do you want to sum the Ending Inventory for the month of August and Begin Inventory for September (as per the data shared).

     

    Thanks,

    Ani

  • v-eachen-msft's avatar
    v-eachen-msft
    Icon for Community Support rankCommunity Support

    Hi Amp_ ,

     

    At first, you need to create a new column.

    Rank =
    RANKX ( 'Table', 'Table'[Date],, ASC, DENSE )
    

    Then create your “Ending Inventory” column based on it.

    End =
    CALCULATE (
        MIN ( 'Table'[Begin] ),
        FILTER (
            'Table',
            'Table'[Rank]
                = EARLIER ( 'Table'[Rank] ) + 1
                && 'Table'[Name] = EARLIER ( 'Table'[Name] )
        )
    )
    

    Here is the result.

     

    Best Regards,

    Eads

     

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