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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
vivran22
Community Champion
Community Champion

Distribute monthly value to daily

Hey community members!

 

Need help.

 

I have a monthly table for target:

Month Target
Jan-20 11
Feb-20 11
Mar-20 7
Apr-20 6
May-20 6
Jun-20 17
Jul-20 10
Aug-20 10
Sep-20 10
Jan-20 57
Feb-20 45
Mar-20 43
Apr-20 36
May-20 36
Jun-20

12

 

 

And then a daily table for actual:

Date Actual
1-Jan-20 2
2-Jan-20 2
3-Jan-20 2
4-Jan-20 3
5-Jan-20 3
6-Jan-20 3
7-Jan-20 4
1-Feb-20 6
2-Feb-20 10
3-Feb-20 12
4-Feb-20 9
5-Feb-20 8
6-Feb-20 7
7-Feb-20 5
8-Feb-20 12
10-Mar-20 10
11-Mar-20 4
12-Mar-20 4
13-Mar-20 4
14-Mar-20 4
15-Mar-20 3
16-Mar-20 3
17-Mar-20 3

 

 

Required visual:

 

image.png
The requiremnt is to compare the monthly values with daily values:

 

The solution could be simple one, but unable to wrap my head around it 😞

 

2 REPLIES 2
BA_Pete
Super User
Super User

Hi @vivran22 

 

Add a combined column to your target table that includes all the dimensions that you want to be able to filter on, as well as month:

// Call this "targetTable" so the join works with next table
let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8krM0zUyUNJRcgRiQ0OlWJ1oJbfUJAwx38QihJg5WMixAEnIDKqqEl3IqxTZAnOoWA6SmAHEtNJ0DLHg1AIMMbiDnYDY1BzVwSAxE1NUB4PFjFFdDBIzRnMykhjczSAxQyOl2FgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Month = _t, Location = _t, Target = _t]),
    addLocationMonth = Table.AddColumn(Source, "locationMonth", each Text.Combine({[Location], [Month]}, "-"), type text)
in
    addLocationMonth

 

Then add the same combined column to your actual table and join on this column:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bdExDsIwDEbhu2RupMZ2kq4wMCBxgqhDkVgZuP8AqkCpyRu8fNMvv9ZCitftGWUOUzh9TsI6tSCESmgedcdMWAirR9sxxcvj/o9CqIRGmAmLx98kwIUwzfG2vYb1CVVQFdVQs9fvhoJaUfuzz5S6oxKaxyF1x0JYPQ6pOwqhEhphJiweh9QdF8Jj6sP6hCqoimqo2euY+qB10PUN", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Location = _t, Actual = _t]),
    addLocationMonth = Table.AddColumn(Source, "locationMonth", each Text.Combine({[Location], Text.End([Date], 6)}, "-"), type text),
    mergeTargetTable = Table.NestedJoin(addLocationMonth, {"locationMonth"}, targetTable, {"locationMonth"}, "targetTable", JoinKind.LeftOuter),
    expandTargetTable = Table.ExpandTableColumn(mergeTargetTable, "targetTable", {"Target"}, {"Target"})
in
    expandTargetTable

 

This should give you table that will do want you need.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




CNENFRNL
Community Champion
Community Champion

Hi, @vivran22 , how about averaging monthly target according to days in the daily table? e.g. Jan-20, 11/7; Feb-20, 11/8


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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