The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
With help from this community, I've been working out how to change reading ages for pupils in a school into a years months format. This is now done and working. My one last thing - the icing on the cake - is that the formula below gives me a result in the format 12 Years 9.1764705882353 Months for our year 7 cohort. Can the formula below be changed so that I can set to 1 decimal place? The format of the column in Power BI is text - if I change it to a number I then get an error...
Solved! Go to Solution.
Reading Age Averaged =
VAR year1 = INT('Reading Ages'[Average RA] / 12)
VAR month1 = 'Reading Ages'[Average RA] - year1 * 12
RETURN
SWITCH(
TRUE(),
'Reading Ages'[Average RA] < 12, "0 Year " & FORMAT('Reading Ages'[Average RA], "0.0") & " Months",
'Reading Ages'[Average RA] = 12, "1 Year 0 Months",
year1 & " Years " & FORMAT(month1, "0.0") & " Months"
)
Reading Age Averaged =
VAR year1 = INT('Reading Ages'[Average RA] / 12)
VAR month1 = 'Reading Ages'[Average RA] - year1 * 12
RETURN
SWITCH(
TRUE(),
'Reading Ages'[Average RA] < 12, "0 Year " & FORMAT('Reading Ages'[Average RA], "0.0") & " Months",
'Reading Ages'[Average RA] = 12, "1 Year 0 Months",
year1 & " Years " & FORMAT(month1, "0.0") & " Months"
)
Hi @duesouth - Can you try the below updated measure:
Reading Age Averaged =
var year1 = INT('Reading Ages'[Average RA] / 12)
var month1 = ROUND('Reading Ages'[Average RA] - year1 * 12, 1)
return
SWITCH(
TRUE(),
'Reading Ages'[Average RA] < 12, "0 Year " & month1 & " Months",
'Reading Ages'[Average RA] = 12, "1 Year 0 Months",
year1 & " Years " & month1 & " Months"
)
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
137 | |
115 | |
111 | |
65 | |
54 |
User | Count |
---|---|
229 | |
117 | |
109 | |
93 | |
91 |