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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

TEXTJOIN with an OFFSET using DAX

Hi all,

 

I'm having some difficulty trying to replicate a formula used in excel within a calculated column in Power BI

The formula within excel in cell c2 of the sample data below is 
=TEXTJOIN(",",TRUE, OFFSET(B2,0,0,COUNTIF(A:A,A2),1))

 

Essentially what it does is, in the sample data attached, it looks through the ID column. The ID in row 10 appears only once, and it returns only FY2022-Q1 (from the Quarter column).

If the same ID appears four times (see rows 2-5),
in cell C2, it will join FY2022 - Q1, FY2022 - Q2, FY2022 - Q3, FY2022 - Q4,
in cell C3, it will join FY2022 - Q2,FY2022 - Q3,FY2022 - Q4,FY2022 - Q1,

in cell C4, it will join FY2022 - Q3,FY2022 - Q4,FY2022 - Q1,FY2022 - Q2,
in cell C5, it will join FY2022 - Q4,FY2022 - Q1,FY2022 - Q2,FY2022 - Q3

Any help replicating this formula would be greatly appreciated. 

IDQUARTERExpected Result
5001002FY2022 - Q1FY2022 - Q1,FY2022 - Q2,FY2022 - Q3,FY2022 - Q4
5001002FY2022 - Q2FY2022 - Q2,FY2022 - Q3,FY2022 - Q4,FY2022 - Q1
5001002FY2022 - Q3FY2022 - Q3,FY2022 - Q4,FY2022 - Q1,FY2022 - Q2
5001002FY2022 - Q4FY2022 - Q4,FY2022 - Q1,FY2022 - Q2,FY2022 - Q3
5001003FY2022 - Q1FY2022 - Q1,FY2022 - Q2,FY2022 - Q3,FY2022 - Q4
5001003FY2022 - Q2FY2022 - Q2,FY2022 - Q3,FY2022 - Q4,FY2022 - Q1
5001003FY2022 - Q3FY2022 - Q3,FY2022 - Q4,FY2022 - Q1,FY2022 - Q1
5001003FY2022 - Q4FY2022 - Q4,FY2022 - Q1,FY2022 - Q1,FY2022 - Q1
5001004FY2022 - Q1FY2022 - Q1
5001006FY2022 - Q1FY2022 - Q1
5001007FY2022 - Q1FY2022 - Q1
5001008FY2022 - Q1FY2022 - Q1
5001009FY2022 - Q1FY2022 - Q1
5001010FY2022 - Q1FY2022 - Q1
5001011FY2022 - Q1FY2022 - Q1
5001012FY2022 - Q1FY2022 - Q1
5001013FY2022 - Q1FY2022 - Q1
5001014FY2022 - Q1FY2022 - Q1
5001015FY2022 - Q1FY2022 - Q1
5001016FY2022 - Q1FY2022 - Q1
5001017FY2022 - Q1FY2022 - Q1
5001018FY2022 - Q1FY2022 - Q1
5001019FY2022 - Q1FY2022 - Q1
5001020FY2022 - Q1FY2022 - Q1
5001021FY2022 - Q3FY2022 - Q3
5001022FY2022 - Q2FY2022 - Q2
5001023FY2022 - Q2FY2022 - Q2
5001024FY2022 - Q1FY2022 - Q1
5001026FY2022 - Q1FY2022 - Q1,FY2022 - Q2,FY2022 - Q3,FY2022 - Q4
5001026FY2022 - Q2FY2022 - Q2,FY2022 - Q3,FY2022 - Q4,FY2022 - Q1
5001026FY2022 - Q3FY2022 - Q3,FY2022 - Q4,FY2022 - Q1,FY2022 - Q2
5001026FY2022 - Q4FY2022 - Q4,FY2022 - Q1,FY2022 - Q2,FY2022 - Q3
5001027FY2022 - Q1FY2022 - Q1,FY2022 - Q2,FY2022 - Q3,FY2022 - Q4
5001027FY2022 - Q2FY2022 - Q2,FY2022 - Q3,FY2022 - Q4,FY2022 - Q4
5001027FY2022 - Q3FY2022 - Q3,FY2022 - Q4,FY2022 - Q4,FY2022 - Q1
5001027FY2022 - Q4FY2022 - Q4,FY2022 - Q4,FY2022 - Q1,FY2022 - Q2
5001028FY2022 - Q4FY2022 - Q4
5001029FY2022 - Q1FY2022 - Q1,FY2022 - Q2,FY2022 - Q3,FY2022 - Q4
5001029FY2022 - Q2FY2022 - Q2,FY2022 - Q3,FY2022 - Q4,FY2022 - Q1
5001029FY2022 - Q3FY2022 - Q3,FY2022 - Q4,FY2022 - Q1,FY2022 - Q1
5001029FY2022 - Q4FY2022 - Q4,FY2022 - Q1,FY2022 - Q1,FY2022 - Q1

 

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@Anonymous 

First, add an index column in Power Query then add the following column using DAX in your data model

 

Column = 
VAR __IND = Table1[Index] RETURN
CONCATENATEX(
    CALCULATETABLE(
        VALUES(Table1[QUARTER]),
        Table1[Index] >= __IND && Table1[Index] < __IND + 4,
        REMOVEFILTERS(Table1)
    ),Table1[QUARTER],", ",Table1[QUARTER]
)

Fowmy_0-1634014175669.png


File attached below

 

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

5 REPLIES 5
Fowmy
Super User
Super User

@Anonymous 

First, add an index column in Power Query then add the following column using DAX in your data model

 

Column = 
VAR __IND = Table1[Index] RETURN
CONCATENATEX(
    CALCULATETABLE(
        VALUES(Table1[QUARTER]),
        Table1[Index] >= __IND && Table1[Index] < __IND + 4,
        REMOVEFILTERS(Table1)
    ),Table1[QUARTER],", ",Table1[QUARTER]
)

Fowmy_0-1634014175669.png


File attached below

 

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

Hi Fowmy,

 

Thank you for your reply,

 

When I use that formula in my file, for some reason I only get a return of the same value as is in the Quarter column, without it being joined with the previous quarters. Do you know what may be impacting this?

Anonymous
Not applicable

Never mind, it was my mistake. Your formula worked perfectly. Thank you so much!

wdx223_Daniel
Super User
Super User

 

wdx223_Daniel_0-1634024653359.png

 

 

Anonymous
Not applicable

Hi wdx223_Daniel,

 

Thank you for your response.

 

I have tried your solution as well and I get the same result as I do with Fowmy's above where the calculated column returns the same result as is in the quarter column, without joining the previous/future quarters. I'm not sure what could be messing with it.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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