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.
I have a table of Deals with following fields:
Now I need to create the table of invoices, with the date column:
Solved! Go to Solution.
HI @Anonymous,
It is possible to generate a table with specific increase date, but it is impossible to make it dynamic based on slicer or filters.
Sample:
Expand = VAR _start = DATE ( 2015, 1, 1 ) VAR _end = TODAY () VAR _calendar = CALENDAR ( _start, _end ) VAR temp = SELECTCOLUMNS ( { ( DATE ( 2015, 1, 1 ), TODAY () ) }, "StartDate", [Value1], "EndDate", [Value2] ) VAR interval = 2 RETURN DISTINCT ( SELECTCOLUMNS ( FILTER ( ADDCOLUMNS ( CROSSJOIN ( temp, _calendar ), "Rolling Date", DATE ( YEAR ( [StartDate] ), MONTH ( [StartDate] ) + interval * DATEDIFF ( [StartDate], [Date], MONTH ), DAY ( [StartDate] ) ) ), [Rolling Date] <= [EndDate] ), "Start Date", [StartDate], "End Date", [EndDate], "Rolling Date", [Rolling Date] ) )
Notice: Bold part is modicatable.
Regards,
Xiaoxin Sheng
You could also do this in the query editor: https://www.thebiccountant.com/2017/12/11/date-datesbetween-retrieve-dates-between-2-dates-power-bi-...
Copy the code into the advanced editor of an empty query and name it "fnDatesBetween".
Then add a column to your table where you call the function and reference the relevant columns like so:
fnDatesBetween([StartDate], [EndDate], "Month")
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
HI @Anonymous,
It is possible to generate a table with specific increase date, but it is impossible to make it dynamic based on slicer or filters.
Sample:
Expand = VAR _start = DATE ( 2015, 1, 1 ) VAR _end = TODAY () VAR _calendar = CALENDAR ( _start, _end ) VAR temp = SELECTCOLUMNS ( { ( DATE ( 2015, 1, 1 ), TODAY () ) }, "StartDate", [Value1], "EndDate", [Value2] ) VAR interval = 2 RETURN DISTINCT ( SELECTCOLUMNS ( FILTER ( ADDCOLUMNS ( CROSSJOIN ( temp, _calendar ), "Rolling Date", DATE ( YEAR ( [StartDate] ), MONTH ( [StartDate] ) + interval * DATEDIFF ( [StartDate], [Date], MONTH ), DAY ( [StartDate] ) ) ), [Rolling Date] <= [EndDate] ), "Start Date", [StartDate], "End Date", [EndDate], "Rolling Date", [Rolling Date] ) )
Notice: Bold part is modicatable.
Regards,
Xiaoxin Sheng
You could also do this in the query editor: https://www.thebiccountant.com/2017/12/11/date-datesbetween-retrieve-dates-between-2-dates-power-bi-...
Copy the code into the advanced editor of an empty query and name it "fnDatesBetween".
Then add a column to your table where you call the function and reference the relevant columns like so:
fnDatesBetween([StartDate], [EndDate], "Month")
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
94 | |
82 | |
66 | |
58 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |