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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Zosy
Helper I
Helper I

YTD for daily and monthly datasets

Hi,

Kindly need your help to solve this problem. I have 2 sets of data, one has all daily invoices and the other one has the monthly budgets.  How could I calculate the % achieved by sales from budget if my data doesn't have the same granularity but I need to show the achievement to today's date (budget is not split by date)?

Datasets:

Invoice NumberDateAmount
36-Jan-23100
87-Jan-23200
225-Jan-23500
725-Jan-23900
725-Jan-23300
725-Jan-23800
422-Feb-231300
1115-Sep-23500
1220-Jan-232000
1220-Jan-23400
920-Mar-2350
115-Sep-23900
1010-Apr-23800
5

22-Feb-23

500
615-Sep-23400

 

 

Budget MonthAmount
January500
February50
March200
April5000
May300
June800
July200
August100
September5000
October200
November400
December300
1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @Zosy ,

Here are the steps you can follow:

1. Create calculated table.

Date =
CALENDAR(
    DATE(2023,1,1),
    DATE(2023,12,31))

vyangliumsft_0-1675759080286.png

2. Create calculated column.

Month =
MAXX(FILTER(ALL('Date'),FORMAT('Date'[Date],"mmmm")='Table2'[Budget Month]),MONTH('Date'[Date]))

vyangliumsft_1-1675759080287.png

3. Create measure.

Measure =
var _YTD=
SUMX(
    FILTER(ALL(Table1),
    'Table1'[Date]>=DATE(YEAR(TODAY()),1,1)&&'Table1'[Date]<=TODAY()),'Table1'[Amount])
var _month=
SUMX(
    FILTER(ALLSELECTED('Table2'),'Table2'[Month]<=MONTH(TODAY())),[Amount])
return
DIVIDE(
    _month,_YTD)

4. Result:

vyangliumsft_2-1675759080288.png

 

Best Regards,

Liu Yang

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

View solution in original post

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

Hi  @Zosy ,

Here are the steps you can follow:

1. Create calculated table.

Date =
CALENDAR(
    DATE(2023,1,1),
    DATE(2023,12,31))

vyangliumsft_0-1675759080286.png

2. Create calculated column.

Month =
MAXX(FILTER(ALL('Date'),FORMAT('Date'[Date],"mmmm")='Table2'[Budget Month]),MONTH('Date'[Date]))

vyangliumsft_1-1675759080287.png

3. Create measure.

Measure =
var _YTD=
SUMX(
    FILTER(ALL(Table1),
    'Table1'[Date]>=DATE(YEAR(TODAY()),1,1)&&'Table1'[Date]<=TODAY()),'Table1'[Amount])
var _month=
SUMX(
    FILTER(ALLSELECTED('Table2'),'Table2'[Month]<=MONTH(TODAY())),[Amount])
return
DIVIDE(
    _month,_YTD)

4. Result:

vyangliumsft_2-1675759080288.png

 

Best Regards,

Liu Yang

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

Thank you! It worked 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.