cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SofticKabir
Helper III
Helper III

Text format not working

Hello, I have a Linechart where I display dates. I want them to be in following format "dd.mm.yyyy".

This is the code of the items property from the linechart:

Sort(AddColumns(GroupBy(Table1;"Datum";"Grouped");"Total";CountRows(Grouped));Text(DateAdd(Datum;-1;Days);"[$-de-DE]dd.mm.yyyy"))

 

As you can see, I am using "[$-de-DE]dd.mm.yyyy" as format, but I still get following format "dd.mm.yyyy hh:mm".

SofticKabir_0-1622838379694.png


How to fix this?

Best regards

2 ACCEPTED SOLUTIONS

Accepted Solutions
RandyHayes
Super User III
Super User III

@SofticKabir 

Your formula is specifying a text format for the sort, not for the results.

Please consider changing your Formula to the following:

Sort(
    AddColumns(
        GroupBy(Table1; "Datum"; "Grouped");
        "Total"; CountRows(Grouped);
        "txtDatum"; Text(DateAdd(Datum;-1;Days); "[$-de-DE]dd.mm.yyyy")
    );
    Datum
)

Set your labels then to txtDatum.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

RandyHayes
Super User III
Super User III

@SofticKabir 

Yes, so you would just need to group by the month instead of the date.

Sort(
    AddColumns(
        GroupBy(
            AddColumns(Table1;
                "_month"; Text(Datum; "mm.yyyy")
            );
            "_month"; "Grouped"
        );
        "Total"; CountRows(Grouped);
        "_sort"; Text(First(Grouped).datum; "yyyymm")
    );
    _sort
)

Your Series would be Total and your Labels would be _month.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

7 REPLIES 7
RandyHayes
Super User III
Super User III

@SofticKabir 

Your formula is specifying a text format for the sort, not for the results.

Please consider changing your Formula to the following:

Sort(
    AddColumns(
        GroupBy(Table1; "Datum"; "Grouped");
        "Total"; CountRows(Grouped);
        "txtDatum"; Text(DateAdd(Datum;-1;Days); "[$-de-DE]dd.mm.yyyy")
    );
    Datum
)

Set your labels then to txtDatum.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

Hello @RandyHayes ,

 

this is helpful, but now the dates are not in the correct order. I want it ti be ascending. Now it is just random.

RandyHayes
Super User III
Super User III

@SofticKabir 

If Datum is a Date column in your datasource, then it should be sorted in ascending order based on the date.

Is Datum a Date column?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes,

 

Datum is a date column of type Date.

RandyHayes
Super User III
Super User III

@SofticKabir 

Then with that formula, your dates should be sorted in an ascending order.

You say that it is random, but do you see any pattern to it?  Perhaps a screenshot would be helpful.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hello @RandyHayes ,

actually now it is in the right order, I am not sure what happened but, now it works all fine!

Also, I am asking myself whether it is possible to display the values, on the x axis, per month instead of per day.

 

For example, let's assume we have 5 dates:

01.02.2021

12.05.2021
17.05.2021
29.05.2021
05.06.2021

 

Then there would be 3 values on the x axis in the format of "mm.yyyy".


How could one do this?

RandyHayes
Super User III
Super User III

@SofticKabir 

Yes, so you would just need to group by the month instead of the date.

Sort(
    AddColumns(
        GroupBy(
            AddColumns(Table1;
                "_month"; Text(Datum; "mm.yyyy")
            );
            "_month"; "Grouped"
        );
        "Total"; CountRows(Grouped);
        "_sort"; Text(First(Grouped).datum; "yyyymm")
    );
    _sort
)

Your Series would be Total and your Labels would be _month.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,253)