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
kan
Helper I
Helper I

how to show months and then remaining days left as days

Hi I have a stacked column chart 

 

Hi I have a stacked column chart  which represents average  months that are required to complete tasks for each region.some has values =18.68(which means 18 months and remaining days).I want to show it in visualisation as example 18months,21days instead of 18.78.If this possible Can someone please help.

 

image.png

 

 

image.png

 

Thanks

1 ACCEPTED SOLUTION
v-jiascu-msft
Employee
Employee

Hi @kan,

 

Since 18months,21days isn't a number, it can't be added to the Value field. I would suggest adding it as a tooltip. Please refer to the snapshot below.

Measure =
VAR avgMonth =
    AVERAGE ( Table1[MonthsThruInterval] )
VAR intMonth =
    INT ( avgMonth )
VAR intDay =
    MOD ( avgMonth, intMonth ) * 30
RETURN
    intMonth & " Months "
        & intDay
        & " Days"

how-to-show-months-and-then-remaining-days-left-as-days

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-jiascu-msft
Employee
Employee

Hi @kan,

 

Since 18months,21days isn't a number, it can't be added to the Value field. I would suggest adding it as a tooltip. Please refer to the snapshot below.

Measure =
VAR avgMonth =
    AVERAGE ( Table1[MonthsThruInterval] )
VAR intMonth =
    INT ( avgMonth )
VAR intDay =
    MOD ( avgMonth, intMonth ) * 30
RETURN
    intMonth & " Months "
        & intDay
        & " Days"

how-to-show-months-and-then-remaining-days-left-as-days

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks Dale,It worked for me.Also can you please let me know if there is any dax to calculate no.of months from given total no.of days.

Example :If no .of days=129 then months would be 129/30=4.3.But I am looking if any dax function is available to calculate this.

 

Thanks

Kan.

Hi Kan,

 

That's a basic math calculation. You can calculate it directly like below.

Measure 2 = 129/30

how-to-show-months-and-then-remaining-days-left-as-days2

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ya I know its a math calculation,but there are months which has 30 days and some 31 days.so thought if there is any function for that.May be i will consider to divide with (365/12=30.4) instead of 30 on an average to do calculation. Thanks.

Hi @kan,

 

I didn' aware of any function to do that. That would be complicated. For example, days from 5th Feb to 10th Apr. So the calculation process depends on your desired precision.

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.