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

CONCATENATEX - I want to concatenate a value for selected dates

Dear All,

Greetings!

Below screenshot is my expected report output in matrix table. I am using date table on slicer, and i was selected two months (Dec-22 & Oct-22).

In matrix table

rows: id, name and "concat of st" measure.

column: date table [month,year]

values: st, dr, cr

 

the measure "concat of st" should concatenate the value of "st" for the selected month,year. 

stanleycj_0-1678453494379.png

Looking for experts advise.

 

Regards,

Stanley R

2 ACCEPTED SOLUTIONS

@stanleycj 

great!  
yes, there is no way to hide them automatically rather you need to follow my sample file and hide them manually after disabling text wrapping. 

View solution in original post

@stanleycj 
You should have mentioned that from the beginning.

Please refer to attached sample file with the updated solution

1.png2.png3.png4.png

View solution in original post

14 REPLIES 14
tamerj1
Super User
Super User

Hi @stanleycj 
It's not an optimum solution but seems to serve the requirement. Please refer to attached file for more details..

1.png2.png3.png

Dear @tamerj1 ,

Thank you so much for your kind support and regret for my late reply.

I am getting the error: Cannot convert value '' of type Text to type Number. when i am selecting "Concat of"

I tried with replacing the datatype, but i couldn't achive it.

Could you please suggest me.

 

Regards,

Stanley R

@stanleycj 
Would you please share a screenshot of the error and what you have achieved so far?

Dear @tamerj1 ,

 

Added screenshot fyr.

 

QRY_TBL

stanleycj_0-1678882764356.png

Qry_Apd_Tbl

stanleycj_1-1678882840041.png

 I am using the Qry_Apd_Tbl in slicer

 

stanleycj_2-1678882932512.png

 

Measure i created as you suggested:

 

Stage Compare =

 IF (
    SELECTEDVALUE ( Qry_Apd_Tbl[Index] ) = 0,
    VALUE (
        CONCATENATEX (
            ALLSELECTED ( Qry_Apd_Tbl ),
            CALCULATE ( SUM ( 'DMP VW_DATA'[ST_SKEY] ) )
        )
    ),
    SUM ( 'DMP VW_DATA'[ST_SKEY] )
)

 

when we select "Movement" from the slicer, getting below error.

 

Release:
December 2022

Product Version:
2.112.603.0 (22.12) (x64)

Error Message:
MdxScript(Model) (165, 5) Calculation error in measure 'DMP VW_DATA'[ST_SKEY]: Cannot convert value '' of type Text to type Number.

OS Version:
Microsoft Windows NT 10.0.19045.0 (x64 en-US)

CLR Version:
4.8 or later [Release Number = 528372]

 

 

@stanleycj 

What is the data type of the 'DMP VW_DATA'[ST_SKEY] column? Can you provide a screenshot?

Dear @tamerj1 

I tried with Union query as you suggested and then to avoid this datatype error, I created a static table and merged together and tried. but still the error persist.

 

Kindly find the attached screenshot fyr.

Since, its a sensitive data couldn't share full screen shot and thanks for understanding.

 

stanleycj_0-1678947895948.png

 

Also, I feel the datatype issue on Qry_Apd_Tbl, Coz when we select the value "Movement" on slicer we are getting the error, whereas  SUM ( 'DMP VW_DATA'[ST_SKEY] ) is working fine while selecting the month(s).

 

Stage Compare =

 IF (
    SELECTEDVALUE ( Qry_Apd_Tbl[Index] ) = 0,

 

Thank you.

 

Dear @tamerj1 ,

 

Just now, I tried without value() and there is no error. whereas i am getting all the other fields on the movement group. 

 

Capture.PNG

@stanleycj 

great!  
yes, there is no way to hide them automatically rather you need to follow my sample file and hide them manually after disabling text wrapping. 

@stanleycj 

great!  
yes, there is no way to hide them automatically rather you need to follow my sample file and hide them manually after disabling text wrapping. 

Dear @tamerj1 ,

Greetings!

 

Today, I was requested to do filter on concatenated value. Hence I have created one more measure as mentioned below

 

Stage Status Desc =
                IF([Stage Compare]=22, "No Change from Stage 2",
                IF([Stage Compare]=23, "Stage 2 to 3",
                IF([Stage Compare]=32, "Stage 3 to 2"
                )))
 
and then, I have created a table as mentioned below.
Stage Status =
var st = SUMMARIZE('DMP VW_DATA','DMP VW_DATA'[ACCNUMBER], "Status",[Stage Status Desc])
RETURN
SUMMARIZE(st,[Status])
 
and, I have added "status" field in the slicer. whereas its shows only "blank".
 
Could you please suggest me, what mistake i have made.
 
Thanks a lot.
 
Stanley R

@stanleycj 
You should have mentioned that from the beginning.

Please refer to attached sample file with the updated solution

1.png2.png3.png4.png

tamerj1
Super User
Super User

Hi @stanleycj 
You may try the following:

Create a Year Month table using the following DAX

1.png

Year Month Table = 
UNION ( 
    ALLNOBLANKROW ( 'Date'[Year Month], 'Date'[Year Month Key] ),
    { ( "Concat of", 1 ) }
)

Create relationship with the main Date table as follows

2.png

The the measure [St] can be modified as 

St2 = 
IF ( 
    SELECTEDVALUE ( 'Year Month Table'[Year Month Key] ) = 1,
    CONCATENATEX ( 
        ALLSELECTED ( 'Year Month Table' ),
        [St]
    ),
    [St]
)

Place [St2] measure in the matrix instead of [St] then edit the name in visual pane as needed

rautaniket0077
Resolver I
Resolver I

Please provide the data (sample) for solving.

 

Dear @rautaniket0077@tamerj1 ,

Greetings!

Kindly find the sample data and output sample fyr and thank you for your response.

 

Table: MonthDetail_Tbl
idnamestvalMthYr
1abc1100Dec-22
2xyx2300Dec-22
3sdf2300Dec-22
4wer31000Dec-22
5jytt1100Dec-22
6brrtg1543Dec-22
7kuh2235Dec-22
8sdfs17546Dec-22
1abc2100Jan-23
2xyx250Jan-23
3sdf1300Jan-23
4wer21000Jan-23
5jytt2100Jan-23
6brrtg1543Jan-23
7kuh3235Jan-23
8sdfs27546Jan-23

 

Filtering the MthYr by slicer on Date_Tbl

Date_tbl.MthYr and MonthDetail_Tbl.MthYr has relationship.

 

Table: Date_Tbl
MthYrQuarterQrYrYearDays in MonthIndex
FEB-2312023,Q12023281
JAN-2312023,Q12023312
DEC-2242022,Q42022313
NOV-2242022,Q42022304
OCT-2242022,Q42022315
SEP-2232022,Q32022306

 

expected report output. (In matrix: I have kept id, name, concat of st in rows, MthYr in columns and st, val in values).

stanleycj_0-1678699565969.png

 

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.

Top Solution Authors