cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Magistralis
Frequent Visitor

M solution converted to DAX

Good day beautiful people,

 

I need a help with below solution, for now it is made in PQ. This is just one piece of bigger query, which unfortunately is causing some issues with performance so I would like to switch from PQ to DAX.

 

Date format: d/m/yyyy

 

What I need?

IDAging_Start_DateEnd_Date
ABC1231/1/20221/5/2022

 

Above table contains about 10k rows with unique IDs and dates for each.

What I need to present on visualization is how many IDs were aged per month. Main problem is that I have only start_date and end_date, so if my filters are between 1/2/2022 - 4/1/2022 this ID will be ignored or I will just see data for January and May.

 

I need to see data for Jan 1st, Feb 1st, Mar 1st, Apr 1st and May 1st (1 per month).

 

I'm using below PQ solution which works amazing but I would like to get rid of heavy calculations (merges etc.) from PQ and focus on DAX only.

 

let

AllDates = {Number.From([Aging_Start_Date])..Number.From([End_Date])},

 

StofMonthDates =

List.Distinct(

List.Transform(

AllDates, each Date.StartOfMonth(Date.From(_))
)
)

in
StofMonthDates

 

 Credits: Generate Dates between Start and End Date in Power Query - YouTube

 

Is there a way to receive similar result as with above query? Sample of the result is presented below.

 

IDAging_Start_DateEnd_Date
ABC1231/1/20221/5/2022

 

After query will be transformed to:

 

IDStofMonthDates
ABC1231/1/2022
ABC1231/2/2022
ABC1231/3/2022
ABC1231/4/2022
ABC1231/5/2022

 

Edit: I can't center the tables, sorry for this. HTML errors.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

2 REPLIES 2
amitchandak
Super User
Super User

@Magistralis , refer to the file of the blog. Both have little bit different approch

 

https://community.powerbi.com/t5/Community-Blog/How-to-divide-distribute-values-between-start-date-o...

 

 



Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s || Learn 50+ Power Query List Functions
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!!! How to get Quick Help !!
Resources | Master Power BI !! Expertise Power BI !! Power BI For Tableau User !!

Absolutely fantastic solution!
It's quite simple when you look at it but my brain could not figure it out.

 

Thank you!

Helpful resources

Announcements
collabdays lisbon

CollabDays Lisbon - 26 November 2022

Sessions include practical, hands-on experience that will help you take the next step in your career and know-how.

Difinity Conference

Difinity Conference 2022

Difinity is the largest Microsoft Data, AI, Power BI, Power Platform and Business Applications Conference in New Zealand.

European Share Point Conference

European Share Point Conference

This conference returns live and in-person in Copenhagen this 28 November-01 December with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Microsoft 365 Conference â__ December 6-8, 2022

Microsoft 365 Conference - 06-08 December

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.