Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Well, to better understand the context, let me explain the situation. My company provided support in obtaining the data, transforming it, and finally creating connected tables using direct query, which will update by fetching data directly from SAP.
The problem is that, as we know, direct query has many limitations, especially regarding the use of DAX for column aggregation and others. In the development of my report with this data, I managed quite well using measures until a need arose that I couldn't solve, despite trying many different approaches.
Without going into detail, the data table I mentioned is about SAP purchase order requests, and it contains key information in each row, such as:
- Request number
- Request position
- Assigned employee ID
- Request creation date
- Purchase order creation date
- Purchase order number
...among others.
The important thing and my goal are to use a measure or field parameter to segment the different rows based on their treatment days. In other words, each row should perform the operation DATEDIFF("request creation date", "purchase order creation date", days). Based on this result, it should return a category, for example, between 0-15 days, then between 16-30 days, and so on...
Additionally, there are rows that do not have a "purchase order creation date," so they should be segmented differently using DATEDIFF("request creation date", "TODAY", days). These should be categorized similarly to the previous ones, and they represent the non-concluded lines.
The final goal and what I need to achieve is to use this measure or parameter as a legend in visuals or on the X-axis for differentiation. Something similar to what is seen in this visual, where we have the total lines assigned to each assigned employee ID.
I hope I have explained myself correctly. If not, please ask for more data or whatever is necessary to solve this problem. I would be truly grateful for your help. Regards, Juan.
Thank you very much, it was very helpful.
Finally, after doing some research, I was able to solve it. Here is the DAX function used.
Now my problem arises when I want to replicate this procedure for the non-concluded requests. I created a new support table and then copied the formula in a similar way, referencing my new support table and another measure that instead of being a DATEDIFF between the release date and the order creation date, would be a DATEDIFF from the release date until today. However, I don't know why it wouldn't be working.
this is my new dax measures
@JUANROVALETTI Unfortunately you cannot use the measure as a legend but you have to use this approach to handle this. Dynamic segmentation – DAX Patterns
👉 Learn Power BI and Fabric - subscribe to our YT channel - @PowerBIHowTo
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.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.