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
Anonymous
Not applicable

Joining sales & budget tables via a master date table

I have the following schema, sales and budget linked via a date master table.

 

join.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

When I try to load the sales budget figures on my matrix in the context of channel, however it just gives the total budget for the month and not the per channel budget:

 

2.PNG

(the channels are under the blue marker)

 

I can get the channel sales if I join between sales and budget joined on  channel but then I can't use the master date "month" to use the intellisense functions for functions like SAMEPERIODLASTYEAR etc.

 

Any help would be greatly appreciated

 

 

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @Anonymous 

Due to I don't know your data model, I build three tables to have a test.

Calendar Table:

 

Calendar = ADDCOLUMNS(CALENDAR(DATE(2019,1,1),DATE(2020,12,31)) ,"Month",MONTH([Date]))

 

Add calculated column:

 

Month Name = CALCULATE(MAX('Month order'[Month Name]),FILTER('Month order','Month order'[Month]=EARLIER('Calendar'[Month])))

 

Result:

1.png

Sales Table:

3.png

Budge Table:

2.png

And I build relationships between Date columns in three tables.

4.png

I think you may use channel column in Sales table to build the matrix, and I get the same issue like yours.

5.png

You can build a new Channel table, build relationships between Channel columns in new table and Sales/Budge Table and use channel column in new table to build the matrix:

Channel Table:

 

Channel = VALUES(Budge[Channel])

 

Relationships:

6.png

Result:

7.png

However this way is not recommended, you may build a measure to solve this problem.

 

Measure_Value = 
IF (
    ISINSCOPE ( Sales[Channel] ),
    CALCULATE (
        SUM ( Budge[Value] ),
        FILTER ( Budge, Budge[Channel] = MAX ( Sales[Channel] ) )
    ),
    SUM ( Budge[Value] )
)

 

Result:

8.png

You can download the pbix file from this link: Joining sales & budget tables via a master date table

 

Best Regards,

Rico Zhou

 

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

3 REPLIES 3
v-rzhou-msft
Community Support
Community Support

Hi @Anonymous 

Due to I don't know your data model, I build three tables to have a test.

Calendar Table:

 

Calendar = ADDCOLUMNS(CALENDAR(DATE(2019,1,1),DATE(2020,12,31)) ,"Month",MONTH([Date]))

 

Add calculated column:

 

Month Name = CALCULATE(MAX('Month order'[Month Name]),FILTER('Month order','Month order'[Month]=EARLIER('Calendar'[Month])))

 

Result:

1.png

Sales Table:

3.png

Budge Table:

2.png

And I build relationships between Date columns in three tables.

4.png

I think you may use channel column in Sales table to build the matrix, and I get the same issue like yours.

5.png

You can build a new Channel table, build relationships between Channel columns in new table and Sales/Budge Table and use channel column in new table to build the matrix:

Channel Table:

 

Channel = VALUES(Budge[Channel])

 

Relationships:

6.png

Result:

7.png

However this way is not recommended, you may build a measure to solve this problem.

 

Measure_Value = 
IF (
    ISINSCOPE ( Sales[Channel] ),
    CALCULATE (
        SUM ( Budge[Value] ),
        FILTER ( Budge, Budge[Channel] = MAX ( Sales[Channel] ) )
    ),
    SUM ( Budge[Value] )
)

 

Result:

8.png

You can download the pbix file from this link: Joining sales & budget tables via a master date table

 

Best Regards,

Rico Zhou

 

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

Anonymous
Not applicable

thank you for the solution, I tried joining the tables via another channel table and it works really well so I just did it this way.  

 

I also used the measure solution to solve a further issue I was having with open orders and back orders on another presentation I was building and this works great also, thanks!

amitchandak
Super User
Super User

@Anonymous , it has the date you should able to use all time intelligence functions. I can see Date and channel in budget, you should able to analyze data by channel and time and use time intelligence.

 

Power BI — YTD
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
Power BI — QTD
https://medium.com/@amitchandak.1978/power-bi-qtd-questions-time-intelligence-2-5-d842063da839
Power BI — MTD
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e

 

Daily sales - Monthly Target -https://youtu.be/yPQ9UV37LOU

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.