- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Periodicity based calculation (measure) in PowerBI
Hi I have to datasets:
- Calendar of future dates for the next 2 years
- Active subscriptions database with the following clolumns: Subcription_ID, Product_Name, Period_in_Months and Valid_From_Date
So each subsription has a starting date (Valid_From_Date) and based on period (e.g. 2 months) the product will ship as follows:
1st shipment on Valid_From_Date, 2nd shipment on Valid_From_Date + (1 * 2 months), 3rd shipment on Valid_From_Date + (2 * 2 months), 4th shipment on Valid_From_Date + (3 * 2 months), etc.
What I would like to do is a Measure, that would caluclate the number of shipments scheduled for each date in the calendar based on this dataset so I can plot she upcoming shipments for example like this:
I think the trick is in calculating the number of days between the given date and the Valid From date and dividing the result by periodicity in days. If the result of the division is whole number, the shipment is scheduled on that date.
Have you ever tried bulding a mesure like this? I wanted a simple solution instead of building new datasets with 100 of upcoming shipment days for thousands of customers.
Many thanks,
Tomas.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @tomashavlicek ,
My sample:
Calendar =
ADDCOLUMNS (
CALENDAR ( EOMONTH ( TODAY (), -1 ) + 1, EOMONTH ( TODAY (), 24 ) ),
"Year", YEAR ( [Date] ),
"Month", FORMAT ( [Date], "MMM" ),
"MonthSort", MONTH ( [Date] )
)
Measure:
Measure =
VAR _DATEDIFF = DATEDIFF(MAX('Table'[Valid_From_Date]),MAX('Calendar'[Date]),MONTH)
VAR _MOD = MOD(_DATEDIFF,SUM('Table'[Month Interval]))
RETURN
CALCULATE(SUM('Table'[Quantity]),FILTER('Table',_DATEDIFF>=0 && _MOD = 0))
Result is as below.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, thank you very much for the quick reply. I tried the solution but struggle to implement it.
The measue:
The BC Subscriptions table:
Calendar table:
Any relations I should make between the tables?
Thank you very much.
Tomas.

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
01-01-2024 01:58 PM | |||
01-11-2024 04:16 AM | |||
12-08-2023 03:12 PM | |||
07-25-2024 01:48 AM | |||
08-05-2024 10:10 PM |
User | Count |
---|---|
87 | |
81 | |
53 | |
38 | |
35 |