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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
shalujoyce
New Member

How to Aggregate the sum of data from one column based on two dates fields from other table

Hi,

 

I am creating a report using data from two tables. one dimension and one fact table. I have Start date and End date from dimension table and No of persons from fact table joined using a key.

Now in the output report i need the aggregate sum of the No of persons from fact table based on key (from fact & dim) between the start date and end date from the dimension table.

 

Please refer the screen shots below for the reference. Please help me to calculate the aggregate sum of No of persons between the start date and end date.

 

dimension table -input 1dimension table -input 1fact table- input 2fact table- input 2expected output report.JPG

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

Hi @shalujoyce ,

 

Pbix as attached.

re.PNG

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

5 REPLIES 5
v-frfei-msft
Community Support
Community Support

Hi @shalujoyce ,

 

Pbix as attached.

re.PNG

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
parry2k
Super User
Super User

@shalujoyce create relationshion between these two tables on key, create a table visual, drop all columns from dim table, make sure there is no aggregation used for any of the column, drop number of person fro fact table in same table visual and changes its aggregation to sum (which is going to be sum  by default), you will have your output.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thank you for the response.

I have tried this approach but not getting the aggregate sum. getting only the first data  of the corresponding key from fact table, even though selected sum for  the No of persons from fact table.

ie , for key 1 ,no of persons=3 instead of 13

 for key 2 , 2 instead of 8

for  key 3 , 2  instead of 17

 

please advise.

 

 

 

@shalujoyce make sure data type of your no of person column is number, it is not text.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@shalujoyce or share pbix file if it doesn't contain sensitive data, you can share using onedrive/google drive.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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