Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
PowerOn_DP
Helper I
Helper I

Not getting all the values for legend

Hello experts,

 

After a lot of tries I dont understand how can I get all the values from the measure for my bar chart legend

Below is the measure I am trying to create to return lenght of stay in months 

 

Rx Cummulative Length of Stay =
Var FromDate = MIN(DimCalendar[Date])
Var LengthoFStay = SUMX(MyPT_CurrentCustomers, DATEDIFF(MyPT_CurrentCustomers[Started Trial (UTC)], FromDate, MONTH))
Return

SWITCH
(
TRUE(),
LengthoFStay>=0 && LengthoFStay<13,"0 to 12 months stay",
LengthoFStay>=13 && LengthoFStay<25,"13 to 24 months stay",
LengthoFStay>=25,"Over 25 months stay"
)
 
PowerOn_DP_0-1620744229510.png

 

I am trying to get this one

 

PowerOn_DP_1-1620744281658.png

 

Any help will be much appreciated

thanks

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@PowerOn_DP , You can not bucket like this on the measure.

 

Please check this video on bucketing on measure. It requires an independent table and new measures

 

Dynamic Segmentation, Bucketing or Binning: https://youtu.be/CuczXPj0N-k

 

 

If this does not help

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

View solution in original post

4 REPLIES 4
PowerOn_DP
Helper I
Helper I

@amitchandak 

I really appreciate your help.

amitchandak
Super User
Super User

@PowerOn_DP , You can not bucket like this on the measure.

 

Please check this video on bucketing on measure. It requires an independent table and new measures

 

Dynamic Segmentation, Bucketing or Binning: https://youtu.be/CuczXPj0N-k

 

 

If this does not help

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Thanks for sharing @amitchandak 

 

Currently my bar chart looks like below

PowerOn_DP_0-1620744868190.png

 

For which I had a created a belo custom column using dax with fixed column and Today() function to difine the lenght of stay category which helped me to put it on the bar chart nicely.

 

Length of Stay Category =
Var LengthoFStay =DATEDIFF(MyPT_CurrentCustomers[Started Trial (UTC)],TODAY(),MONTH)
Return
SWITCH
(
TRUE(),
LengthoFStay>=0 && LengthoFStay<13,"0 to 12 months stay",
LengthoFStay>=13 && LengthoFStay<25,"13 to 24 months stay",
LengthoFStay>=25,"Over 25 months stay"
)
Now, the change is instead of calculating length of stay from [Started Trial (UTC)] to TODAY(), I need to use Min(DimCalendar[date]) which returns me the start date of each month on bar chart.
 
I have no idea if this measure is going to work.
 
 
 

 

 

 

 

PowerOn_DP
Helper I
Helper I

@V-lianl-msft @amitchandak Please help

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.