Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Month to date based on customized column

Hi,

 

I try to generate month to date based on my customized logic.
As below, I would like to generate a measure in "Ordered Qty MTD" based on "Weeknum&year&month" column which is generated based on "Date" column.  In the visualization, I tried to use time inteliigence, but still fail. Wonder if you could help?

My intention is to only list down by "Weeknum&year&month", "Material No", "Ordered Qty" and "Ordered Qty MTD" columns without showing date, but time intelligence dax would not allow to do so. Thanks.

 

LisaChung_0-1652766952327.png

 

1 ACCEPTED SOLUTION

Hi @Anonymous 
Have you had the chance to check my solution?

View solution in original post

5 REPLIES 5
tamerj1
Super User
Super User

Hi @Anonymous 
Please try

Qty MTD =
VAR CurrentDate =
    MAX ( TableName[Date] )
VAR StartOfMonth =
    DATE ( YEAR ( CurrentDate ), MONTH ( CurrentDate ), 1 )
RETURN
    CALCULATE (
        SUM ( TableName[Ordered Qty] ),
        ALLEXCEPT ( TableName, TableName[Material No] ),
        TableName[Date] <= CurrentDate,
        TableName[Date] >= StartOfMonth
    )

Hi @Anonymous 
Have you had the chance to check my solution?

Anonymous
Not applicable

thanks for helping. It works fine.

tamerj1
Super User
Super User

@Anonymous 
Do you have a datetable? is [Weeknum&year&month] a column? In which table?

Anonymous
Not applicable

Hi @tamerj1 

 

This is the only table I have.  I made "Weeknum&year&month" column on my own. 

They are all in this table. Thanks

 

DateWeeknum&year&monthMaterial NoOrdered Qty
2022/05/01Week 1 of MayA0
2022/05/02Week 2 of MayA3650
2022/05/03Week 2 of MayA23650
2022/05/04Week 2 of MayA2900
2022/05/05Week 2 of MayA450
2022/05/06Week 2 of MayA20550
2022/05/07Week 2 of MayA400
2022/05/09Week 3 of MayA1900
2022/05/10Week 3 of MayA3500
2022/05/11Week 3 of MayA850
2022/05/12Week 3 of MayA1100
2022/05/13Week 3 of MayA250

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.