The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hello,
I am simply trying to plot a line chart with a rate over time, and then put an "ethnicity" field on the legend.
My rate is a calculated field, which should not matter, so I'm not sure why I'm having issues here. Other than the rate being a calculation, I can't think of why this might be happening.
The output is just showing the overal total as one line vs. splitting into many lines per ethnicity.
Any idea what might be happening behind the scenes?
Hi @heidibb ,
How about the result after you follow the suggestions mentioned in my original post?Could you please provide more details about it If it doesn't meet your requirement?
Best regards,
Yes, the ethnicities are overlapping because it's only plotting the overall total vs. splitting by ethnicity, which is what I can't understand.
If I take the "AllSelected" out of the calculation, the legend now works as expected, but my rate is not accurate.
I would like to undersstand why the AllSelected part of this calculation is causing issues in the chart.
Hi @heidibb ,
Could you please try to use allselect on single column instead entire table, such as following:
Rolling Count - Census Retention GR =
VAR __currRow =
MAX ( Main[DegreeLevelCohortTermAxis] )
VAR __startRow = __currRow - 4
RETURN
CALCULATE (
SUM ( Main[b_Year2Retention] ),
ALLSELECTED ( 'Main'[DegreeLevelCohortTermAxis] ),
Main[AcademicLevelCode] = "GR",
'Main'[DegreeLevelCohortTermAxis] >= __startRow,
'Main'[DegreeLevelCohortTermAxis] <= __currRow
)
Rolling Count - Census Retention UR =
VAR __currRow =
MAX ( Main[DegreeLevelCohortTermAxis] )
VAR __startRow = __currRow - 4
RETURN
CALCULATE (
SUM ( Main[b_Year2Retention] ),
ALLSELECTED ( 'Main'[DegreeLevelCohortTermAxis] ),
Main[AcademicLevelCode] = "UR",
'Main'[DegreeLevelCohortTermAxis] >= __startRow,
'Main'[DegreeLevelCohortTermAxis] <= __currRow
)
When use Allselected(Main), it will ignore the Ethnicity Column.
Best regards,
Hi @heidibb ,
I tried a line chart at my end and I get the legend with multiple lines.
Can you check in data, if you are using the right column as legend?
If this helps and resolves the issue, appreciate a Kudos and mark it as a Solution! 🙂
Thanks,
Pragati
Yes, i'm pulling in the correct fields.
For my graduate terms:
Rolling Count - Census Retention GR =
VAR __currRow = max (Main[DegreeLevelCohortTermAxis])
VAR __startRow = __currRow - 4
RETURN
CALCULATE (sum(Main[b_Year2Retention]), ALLSELECTED(Main), Main[AcademicLevelCode] = "GR",
'Main'[DegreeLevelCohortTermAxis] >= __startRow , 'Main'[DegreeLevelCohortTermAxis] <= __currRow)
For my undergraduate terms:
Rolling Count - Census Retention UG =
VAR __currRow = max (Main[DegreeLevelCohortTermAxis])
VAR __startRow = __currRow - 5
RETURN
CALCULATE (sum(Main[b_Year2Retention]), ALLSELECTED(Main), Main[AcademicLevelCode] = "UG",
'Main'[DegreeLevelCohortTermAxis] >= __startRow , 'Main'[DegreeLevelCohortTermAxis] <= __currRow)
% Census Retention =
CALCULATE(SWITCH(SELECTEDVALUE(Main[AcademicLevelCode]), "UG", [Rolling Count - Census Retention UG], "GR", [Rolling Count - Census Retention GR])/
SWITCH(SELECTEDVALUE(Main[AcademicLevelCode]), "UG", [Rolling Count - Student Count UG], "GR", [Rolling Count - Student Count GR]))