March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello, I would like some assistance or ideas.
I'm creating a dashboard that can clasify my customers based on dates of purchase.
The idea is simple, if the days between the last purchase and today is:
Greater than 180 = C
Greater than 30 = B
Greater or equal to 0 = A.
This looks like this:
So thats ok because if I select any chart it will give me a table with the contact information of that specific client.
The problem is that I want the dashboard to save a "screenshot" of every month client classification.
I want to add a slider to select a year, lets say 2023 and a month.
What I want is to know how many clients are type A, B and C for June, July, August or the month I want to choose.
Right now I can only see the a general total of today.
If I want to create charts and add a"Actividad 2" (Activity) to the X axis I'll be able to do it if Activity is a Column, but it's not. Its a measure.
This is an example of what I'm doing right now.
I have a date slider and I have selected every year and month up to June 2023 to finish with 30/06/2023.
Max Date of Selected Month Measure =
VAR SelectedMonthYear = MAX('Calendar'[Date])
VAR MaxDateInSelectedMonth = CALCULATE(
MAX('Calendar'[Date]),
FILTER(ALLSELECTED('Calendar'), 'Calendar'[Date] <= SelectedMonthYear)
)
RETURN
MaxDateInSelectedMonth
What I do next calculate the days between that date and the latest purchase date of month.
Days Between Max Date and Latest Purchase =
VAR MaxSelectedDate = [Max Date of Selected Month Measure]
VAR LatestPurchaseDate = MAX('Clasificacion'[LatestPurchaseDateOfMonth])
VAR CurrentYear = YEAR(TODAY())
VAR CurrentMonth = MONTH(TODAY())
RETURN
IF(
ISBLANK(LatestPurchaseDate),
BLANK(),
IF(
ISBLANK(MaxSelectedDate),
BLANK(),
IF(
CurrentYear = YEAR(MaxSelectedDate) && CurrentMonth = MONTH(MaxSelectedDate),
DATEDIFF(LatestPurchaseDate, TODAY(), DAY), -- Use today's date if the month is current and not closed
DATEDIFF(LatestPurchaseDate, MaxSelectedDate, DAY)
)
)
)
And lastly, I create a measure based on this to classify the clients. But of course, this will not work on a chart because its not a column.
Actividad 2 =
VAR DaysBetween = [Days Between Max Date and Latest Purchase]
RETURN
SWITCH (
TRUE (),
DaysBetween > 180, "C", -- More than 180 days
DaysBetween > 30, "B", -- More than 30 days
DaysBetween >= 0, "A" -- Greater than or equal to 0 days
)
In this case, "Actividad 2" is "C" because it has more than 180 days (634 days).
But this doesn't work for me because I need to save the classification of the clients on a column to use it on charts.
If somehow I manage to convert "Max Date of Selected Month Measure" to a Column, problem would be solved!
Because I'll be able to get the DAYDIFF from Max Date of Selected Month and column "LatestPurchaseDateOfMonth" and then use this to create a column for "Actividad 2" (instead of a measure) to save A, B or C.
But I'm not able to do that because it always select the max date of the whole calendar and not from the specific selection of the slicer.
Any ideas would be highly appreciated.
If something is not clear, please let me know so I can explain with more detail.
Thanks,
Hector
Solved! Go to Solution.
@HectorMSC here is the link to the video, I hope this get you going.
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.
@HectorMSC here is the link to the video, I hope this get you going.
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.
@HectorMSC you are looking for dynamic segmentations. I'm actually working on a video that will show something similar, how you can use measures as columns to be used in grouping/slicers etc. Hang tight or maybe someone help in the meantime.
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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
114 | |
76 | |
57 | |
52 | |
44 |
User | Count |
---|---|
164 | |
116 | |
63 | |
57 | |
50 |