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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Dlahey
Helper I
Helper I

Custom Time Intelligence - Current Day in Month vs. Prior Months

I currently have weekly sales data refresh. I am looking to compare Week 1 of the month vs. prior Week 1's of all the prior months before that visually. In Week 2 I am looking to see a Cumulative sales for week1+2 vs. all prior Week 2 cumulative's of all the prior months. This would be the same for week 3 and week 4 as the data refreshes.

 

Is there custom coding that can allow me to do this? looking at MTD sales vs. Prior MTD using time intelligence does not provide the same outcome I am looking for.

 

thanks,

1 ACCEPTED SOLUTION

Yeah, sort of.  Keep in mind that this will be very wobbly at the beginning of the month.  Let's say

 

July - starts on a Friday

August - starts on a Monday

September - starts on a Thursday

 

Let's assume you only have transactions Monday through Friday.

 

First 6 days:

July: 4 working days

Aug: 5 working days

Sept: 4 working days

 

I think you can see where this is going.  It becomes less of a problem the older a month gets.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @Dlahey ,

 

Based on your description, please try this measure.

Measure = 
VAR _date = CALCULATE(MAX('FactSalesTable'[Date]),ALL('FactSalesTable'))
VAR _day = DAY(_date)
VAR _year = SELECTEDVALUE('Calendar'[Year])
VAR _month = SELECTEDVALUE('Calendar'[Month Number])
VAR _sales = CALCULATE(SUM('FactSalesTable'[Sales]),FILTER('Calendar','Calendar'[Date]>=DATE(_year,_month,1)&&'Calendar'[Date]<=DATE(_year,_month,_day)))
RETURN
_sales

The PBIX file is attached for reference.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

lbendlin
Super User
Super User

I am looking to compare Week 1 of the month vs. prior Week 1's of all the prior months 

Weeks and months are incompatible.

How about days in month vs. same days in month vs. prior months?

 

ie. Sep = 6 days, vs. Aug = first 6 days, vs. Jul = first 6 days.....

Yeah, sort of.  Keep in mind that this will be very wobbly at the beginning of the month.  Let's say

 

July - starts on a Friday

August - starts on a Monday

September - starts on a Thursday

 

Let's assume you only have transactions Monday through Friday.

 

First 6 days:

July: 4 working days

Aug: 5 working days

Sept: 4 working days

 

I think you can see where this is going.  It becomes less of a problem the older a month gets.

I am comfortable with this, we only have refreshed sales data on a weekly basis therefore the minimum days would always be 4 or 5 working days with holidays factored in. However, this still gives a good indication to our company. thanks

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.