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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
sandeshp
Frequent Visitor

Not able to add a measure in the visualization

I have a table which has the a birth_date column. I have added 2 new measures in the table to calculate today's age, and divide the age into age groups:

 

Age measure:

 

Age = DATEDIFF(SELECTEDVALUE(birthDates[birth_date]), TODAY(), DAY) / 365.25

 

Age group measure:

 

AgeGroup = 
var age = [Age]
RETURN
SWITCH(TRUE(),
age < 16, "0-15",
age < 25, "16-24",
age < 34, "25-33",
age < 43, "34-42",
age < 52, "43-51",
age < 61, "52-60",
age < 79, "60-78",
"79+"
)

 

 

I want to create a column chart having age group on the x axis, and count of birth_date on the y axis. But I am not able to add the AgeGroup on the x-axis.

sandeshp_0-1714627996347.png

 

How do I do this?

I have attached the Power BI report link below:

Age Group Power BI report.

4 REPLIES 4
sandeshp
Frequent Visitor

@manvishah17 , @Kishore_KVN 

Thank you for the response. Is there any way I can show how many rows are in each age group, in a column chart?

Genrally countrow dax is used to find no of rows. But it don't take measure in its paramter.
Check this out 
https://learn.microsoft.com/en-us/dax/countrows-function-dax 

manvishah17
Resolver II
Resolver II

Hi @sandeshp , 
You cant plot any measure values on x axis , it should be a coulmn only.
On Y axis you can plot any measure.
For your requirement of plotting this measure in column chart , 
you can do like this ,
Plot date , age, agegroup in tble. 
or do like this 
Screenshot 2024-05-02 112204.png

 

in column chart , plot date column in x axis , measure of age in y axis and agegroup in tooltips.

 If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 
Kishore_KVN
Super User
Super User

Hello @sandeshp ,

FYI we can not add measures directly in to the axis of any visual either you have to create a calculated column or you have to create new What-if Parameter using fields option. 

 

If this post helps, then please consider accepting it as the solution to help other members find it more quickly. Thank You!!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.