Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Dax measure

Hi 
I have a weighted average for Yield but it is for all years in the data set which is 2021 and 2022 however instead of adding a filter to say only show 2022 i want it to be a dynamic dax measure which will change according to the years in the future too. therfore need a measure which gives it back as ytd.

the weighted average measure is:

 

IEA*Yield =
Sumx( 'Sales Report - Detail',' Sales Report - Detail'[IEA]*[yield]
)
Weighted Average Yield =
DIVIDE([IEA*Yield], SUM('Sales Report - Detail'[IEA])


2 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    Anonymous Maybe:

    Measure = CALCULATE([IEA*Yield],FILTER(ALL('Dates'),YEAR('Dates'[Date])=YEAR(TODAY()) && 'Dates'[Date] <= TODAY()))

  • V-lianl-msft's avatar
    V-lianl-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    Please try:
    Measure = TOTALYTD(
    [Weighted Average Yield],
    Date[Order_Date],
    Date[Order_Date] < TODAY()
    )

     


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