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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
sundials
Regular Visitor

Help me create this graph

Hi, I'm trying to recreate this chart here. 

sundials_0-1765469649544.png

But I'm failing and only get this one:

 

sundials_1-1765469691096.png

 

sundials_0-1765470020486.png

 

My summer hire column is found in my data table. I dragged it to my legends. Here's are my DAX formulas for more context:

 

Retained 3M =
VAR PeriodStart = MIN('Calendar'[Date])
VAR PeriodEnd   = MAX('Calendar'[Date])
RETURN
CALCULATE(
    COUNTROWS(Employment),
    Employment[Hire Date] >= PeriodStart &&
    Employment[Hire Date] <= PeriodEnd,
    (
        ISBLANK(Employment[Termination Date]) ||
        Employment[Termination Date] >= EDATE(Employment[Hire Date], 3)
    ),
    CROSSFILTER('Calendar'[Date], Employment[Hire Date], None)
)
 
Retention 3M = DIVIDE([Retained 3M], [Cohort Size], 0)
 
Cohort Size =
CALCULATE(
    COUNTROWS(Employment),
    Employment[Hire Date] >= MIN(Calendar[Date]) &&
    Employment[Hire Date] <= MAX(Calendar[Date])
)
 
I created a disconnected table and create retention % as measure:
 
Retention % =
VAR SelectedPeriod = SELECTEDVALUE(RetentionAxis[Period])
RETURN
SWITCH(
    SelectedPeriod,
    "3M", CALCULATE([Retention 3M]),
    "6M", CALCULATE([Retention 6M]),
    "12M", CALCULATE([Retention 12M]),
    "24M", CALCULATE([Retention 24M]),
    BLANK()
)
 
RetentionAxis =
DATATABLE(
    "Period", STRING,
    "Order", INTEGER,
    {
        {"3M", 1},
        {"6M", 2},
        {"12M", 3},
        {"24M", 4}
    }
)
 
Please help!

 

 

 

1 ACCEPTED SOLUTION
vivien57
Power Participant
Power Participant

Hello

I think, the main problem stems from the fact that your axis (the disconnected RetentionAxis table) does not filter the Calendar table, whereas your Retained 3M / Cohort Size measures use MIN/MAX(Calendar[Date]). As a result, each point on the axis returns the same period (not linked to the 3M, 6M, 12M, 24M), which produces flat lines. Furthermore, if you want multiple lines (e.g. Summer vs Non-Summer), you must use the Legend with a single measure (your ‘switched’ measure), as a Line chart does not accept multiple measures when a Legend is filled. 

Have a nice day,

Vivien

View solution in original post

5 REPLIES 5
v-sshirivolu
Community Support
Community Support

Hi @sundials ,

I would take a moment to thank @vivien57, for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.
 

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions

 

Hi @sundials ,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions

d_m_LNK
Responsive Resident
Responsive Resident

I agree with @Irwan -- the issue is that your Legend needs to the the Summer/non summer column, Y Axis - % retention, X-Axis - month retention.  

Irwan
Super User
Super User

hello @sundials 

 

i might be misunderstood but seems what you are doing is different from what you are trying to recreate.

the desired visual has summer/non-summer legend but your two visuals dont use the same legend.

 

otherwise, try @vivien57 's solution.

 

Thank you.

vivien57
Power Participant
Power Participant

Hello

I think, the main problem stems from the fact that your axis (the disconnected RetentionAxis table) does not filter the Calendar table, whereas your Retained 3M / Cohort Size measures use MIN/MAX(Calendar[Date]). As a result, each point on the axis returns the same period (not linked to the 3M, 6M, 12M, 24M), which produces flat lines. Furthermore, if you want multiple lines (e.g. Summer vs Non-Summer), you must use the Legend with a single measure (your ‘switched’ measure), as a Line chart does not accept multiple measures when a Legend is filled. 

Have a nice day,

Vivien

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.