Forum Discussion

midrississi's avatar
midrississi
Frequent Visitor
5 years ago
Solved

Calculated column based on formula, filter, month and year - using slicer

Hello everybody, I'd like to ask you for help with a calculated column, I'll use the following table to demostrate it on an example,   Table   In order to get the Requested column NEW_P...
  • AlB's avatar
    AlB
    5 years ago

    midrississi 

     

    Try this. If it doesn't work I'd need the pbix to run some tests (or a pbix with dummy data that repros the issues)

    New price = 
    VAR lastMonth_ =
        CALCULATE ( MAX ( 'Table'[NO_MONTH] ),
        ALLSELECTED(),
        SUMMARIZE('Table','Table'[ID_ITEM],'Table'[NO_YEAR] )
        )
    
    VAR priceMoisAnnee_ =
            CALCULATE (
            MAX ('Table'[PRICE]),
            'Table'[NO_MONTH] = lastMonth_,
            ALLSELECTED(),
            SUMMARIZE('Table','Table'[ID_ITEM],'Table'[NO_YEAR] )        
        )
    RETURN
        priceMoisAnnee_ 

     

    Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.

    Cheers