Forum Discussion

Yamabushi's avatar
Yamabushi
Icon for Helper I rankHelper I
3 years ago

CALCULATE with month names

Hi,

 

I'm having a hard time understanding why a measure isn't working. I'm using the AdventureWorks DW

If I try this measure, the filter context isn't changing:

_TotalSalesByYear = CALCULATE([_TotalSales], ALL(DimDate[EnglishMonthName]))

 

 

However, with this measure, the filter context changes:

_TotalSalesByYear = CALCULATE([_TotalSales], ALL(DimDate[MonthNumberOfYear]))

 

I wanted to remove the filter coming from months, so I can later compute the proportion of yearly sales made each month.

I hope the issue and screenshots are clear enough.

 

Best regards

2 Replies

  • Yamabushi , Try meausres like

     

    This Year = CALCULATE([_TotalSales],filter(ALL('DimDate'),'DimDate'[Year]=max('DimDate'[Year])))

     

    This year Sales = CALCULATE([_TotalSales],DATESYTD(ENDOFYEAR('DimDate'[Date]),"12/31"))

     

    Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
    https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5bd4
    To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

  • Hi,

     

    Thanks for typing the measures, they both work as I would like them to.

    My question still stands though. Why does the measure I typed work when I reference the month number, but not when I reference the month name.

     

    I was not looking for a solution but for a technical explanation 🙂

     

    Thanks