Is there a way to add line breaks in a string of text in Microsoft's DAX language?

Viewed 39311

I have a DAX function that pulls in multiple strings of text (from multiple columns) into one cell. But on display I want to have a line break in between the header and the body of the paragraph. Is there a way to code in a line break with DAX? FYI, I'm using Power BI for this. Thanks!

5 Answers

Using DAX String = [field A] & UNICHAR(10) & [field B]

Example: Field A contains text: January 11, 2018 Field B contains text: Happy Birthday Elvis

This will return:

January 11, 2018

Happy Birthday Elvis

First, we have to create string concatenation using CONCATENATE() method, then use UNICHAR(10) to create space between strings

Product Sold Count =

VAR Valuel = "Product Sold" 

VAR Value2 = "Today : " & (
                            CALCULATE(
                                SUMX(
                                    FILTER(
                                            'api_Product Sold',
                                            'api_Product Sold'[Date] = TODAY()
                                        ),
                                    'api_Product Sold'[Count]
                                    )
                                )
                        + 0 ) 

VAR Value3 = "Total : " & (
                            CALCULATE(
                                SUMX(
                                    FILTER(
                                            'api_Product Sold',
                                            'api_Product Sold'[Date] <= TODAY()
                                        ),
                                    'api_Product Sold'[Count]
                                    )
                                )
                        + 0 )  

VAR FirstCONCATENATE = CONCATENATE(CONCATENATE(Valuel,UNICHAR(10)),Value2) 

VAR SecondCONCATENATE = CONCATENATE(CONCATENATE(Value2,UNICHAR(10)),Value3) 

RETURN SecondCONCATENATE

Once your string is ready then select card chat and assign the measure created

enter image description here

Where height of the card chart should be proper then only word wrap will work and before it should be enable the word wrap property on format tab

enter image description here

Related