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

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

Reply
holywasabi
Frequent Visitor

Using DAX in Visualisation

Hi all, I would like created a DAX measure to group users into multiple age ranges, it works well in table form.

But I get an error when using it in other types of visualizations (eg. pie charts / bar charts). 

Any pointers are greatly appreciated 😁 

 

= = = 

Here are my tables / data : 

holywasabi_0-1720346561401.png

Income (Grouped) =
VAR CustomerIncome = MAX( customer[ Income ] )

RETURN
CALCULATE(
    VALUES(  'Group : Income'[Income Range] ),

    FILTER(
    'Group : Income',
    CustomerIncome >=  'Group : Income'[Min] &&
    CustomerIncome <=  'Group : Income'[Max]
    )
)
 
= = = 
 
What I'd like to achieve : 
pie_chartpie_chart

Thank you!

 

1 ACCEPTED SOLUTION
Irwan
Super User
Super User

Hello @holywasabi 

 

please check if this accomodate your need.

Irwan_0-1720399912348.png

 

I am not sure what kind of error did you get but if it works in table form, it should work as well in other visual

Irwan_1-1720399971052.png

 

Apart from the error, please check these : 

1. Created calculated column for 'Income (Grouped)'

Income (Grouped) = MAXX(FILTER('Supporting','Income'[Income]>'Supporting'[Min]&&'Income'[Income]<'Supporting'[Max]),'Supporting'[Income Range])
Irwan_2-1720400281344.png

 

2. Since you want to create pie chart with 'Income Range' as separator/legend, then you need to make a measure to calculate it. Create measure in 'Supporting' Table with following DAX for calculating number of row that has exact same value in 'Income (Grouped)' and 'Income Range'.

Count Customer =
var _Income = SELECTEDVALUE('Supporting'[Income Range])
var _Count = COUNTX(FILTER('Income','Income'[Income (Grouped)]=_Income),COUNTROWS('Income'))
Return
IF(
    _Count=BLANK(),
    0,
    _Count
)
Irwan_5-1720400814988.png
 

3. Plot in pie chart, 'Income Range' as legend and the previous measure (Count Customer) as Values.

Irwan_3-1720400562548.png

After putting values in pie chart, in Visual Format, turn of legend and change Label Content (Detail Label -> Option).

Irwan_4-1720400735684.png

 

Also, in your screecshot table, you only provide two kind of data, the 10k-50k and 50k-100k. The rest of categories dont show up because the value is zero.

 

Hope this will help you.

Thank you.

View solution in original post

2 REPLIES 2
Irwan
Super User
Super User

Hello @holywasabi 

 

please check if this accomodate your need.

Irwan_0-1720399912348.png

 

I am not sure what kind of error did you get but if it works in table form, it should work as well in other visual

Irwan_1-1720399971052.png

 

Apart from the error, please check these : 

1. Created calculated column for 'Income (Grouped)'

Income (Grouped) = MAXX(FILTER('Supporting','Income'[Income]>'Supporting'[Min]&&'Income'[Income]<'Supporting'[Max]),'Supporting'[Income Range])
Irwan_2-1720400281344.png

 

2. Since you want to create pie chart with 'Income Range' as separator/legend, then you need to make a measure to calculate it. Create measure in 'Supporting' Table with following DAX for calculating number of row that has exact same value in 'Income (Grouped)' and 'Income Range'.

Count Customer =
var _Income = SELECTEDVALUE('Supporting'[Income Range])
var _Count = COUNTX(FILTER('Income','Income'[Income (Grouped)]=_Income),COUNTROWS('Income'))
Return
IF(
    _Count=BLANK(),
    0,
    _Count
)
Irwan_5-1720400814988.png
 

3. Plot in pie chart, 'Income Range' as legend and the previous measure (Count Customer) as Values.

Irwan_3-1720400562548.png

After putting values in pie chart, in Visual Format, turn of legend and change Label Content (Detail Label -> Option).

Irwan_4-1720400735684.png

 

Also, in your screecshot table, you only provide two kind of data, the 10k-50k and 50k-100k. The rest of categories dont show up because the value is zero.

 

Hope this will help you.

Thank you.

foodd
Super User
Super User

Hello @holywasabi , remember to adhere to the decorum of the Community Forum when asking a question.

Please provide your work-in-progress Power BI Desktop file (with sensitive information removed) that covers your issue or question completely in a usable format (not as a screenshot).

https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

This allows members of the Forum to assess the state of the model, report layer, relationships, and any DAX applied.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.