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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
walker4545
Frequent Visitor

Create New Table and Populate Rows Conditionally (DAX, Power Query)

Dear Power BI Community,

 

I am hoping for your help with the following problem.

 

I have data from a Gymnasium that also offers training courses for members:

 

GymTrainingTable

CustomerID CourseIDTrainingStartDateEndDateValue
CID4321GB101Gym Basics 1011/01/20201/09/2020$10,000
CID4321IP102Intermediate Power Lifting 1/01/20211/12/2022$14,000
CID4325GT000Gym Trial1/05/20201/09/2020$2,000
CID4435IP102Intermediate Power Lifting 1/01/20201/12/2021$14,000
CID4438GB101Gym Basics 1011/01/20201/09/2020$10,000
CID4438HI102HIIT Training1/01/20211/06/2021$5,000
CID5553HI102HIIT Training1/01/20201/06/2020$5,000
CID5651GB101Gym Basics 1011/01/20211/09/2021$10,000
CID5652IP102Intermediate Power Lifting 1/01/20211/12/2022$14,000
CID4356GT000Gym Trial1/05/20211/05/2022$6,000

 

As above, each Customer enrols into a specific course of training, with a start and end date. the Unique ID for each row is the combination of Customer ID and CourseID, which can be referred to as StudyPlanID

 

I need to work out the installment revenue for each half year period. What I would like to do is create a new installment table to separate the GymTraingingTable into an installments table, which will show projected revenue. 

 

-For those StudyPlanIDs where the course will exceed 6 months, (excluding GT000), the total value of their course is separated into installment payments based on the number of 6 month semesters. Eg. IP102 has a cost of $14000 and duration of 24 months, so there will be 4 installments of $3500. A 9 month course for example will involve 2 installments, the first initially and the second after 6 months.

 

-For those StudyPlanIDs for a course of 6 months or less, (excluding GT000), the total value of their course is due at the beginning of their study. Therefore just a single installment is required.

 

-For any GT000 study, regardless of course length or cost, payments are due monthly. Eg. 12 months of GT000 will cost $6000 overall, and will require 12 monthly installments of $500.

 

How can I create a new table which takes data from GymTrainingTable and creates a new row for each installment that includes the following:

 

CustomerID CourseIDInstallmentNumberInstallmentDueDateValue

Is this possible in DAX alone or will it require a combination of both DAX and Power Query?

 

@amitchandak @SpartaBI Please help if you can!

 

Thanks in advance, Walker

2 REPLIES 2
amitchandak
Super User
Super User

@walker4545 , Try a new Table in DAX

 

 

Table = Addcolumns(filter(generate(Data,SELECTCOLUMNS( GENERATESERIES(5,datediff(Min(Data[StartDate]), Max(Data[EndDate]),Month)+1,6) ,"Value1", [Value])) , [Value1] <=  datediff([StartDate],[EndDate],MONTH)), "Date", EOMONTH([StartDate],[Value1]))

 

find the file attached 

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Dear @amitchandak 

 

Thanks, I think that's a step in the right direction, however I think the new column Value is incorrect, as it still just generates the full amount of the course. Also, for GT000 the price should be broken down into monthly payments, not just one single up front payment. 

 

walker4545_0-1655359045104.png

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Solution Authors