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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
jwdal
Frequent Visitor

Bar graph issue

My matrix has net sales by top 10 customers. The graph shows values for all customers. I want the graph to show values as displayed in the matrix. Sample 

1 ACCEPTED SOLUTION
v-dineshya
Community Support
Community Support

Hi @jwdal ,

Thank you for reaching out to the Microsoft Community Forum.

 

As you mentioned in your query, you want the graph to show values as displayed in the matrix.

 

Please refer below DAX measure.

 

Net Sales (Top10 Customers Selected) =
VAR N = 10
VAR ExcludeCustomer = "OXYCHEM"

VAR TopCustomersTable =
    TOPN(
        N,
        FILTER(
            SUMMARIZE(
                ALLSELECTED(AC_ALL),            
                AC_ALL[Top10],                
                "CustomerSales", [Net_Sales]    
            ),
            AC_ALL[Top10] <> ExcludeCustomer
        ),
        [CustomerSales],
        DESC
    )

VAR TopCustomersSingleColumn =
    SELECTCOLUMNS(TopCustomersTable, "Cust", AC_ALL[Top10])

RETURN
CALCULATE(
    [Net_Sales],
    KEEPFILTERS(
        TREATAS(TopCustomersSingleColumn, AC_ALL[Top10])
    )
)
 
Please refer below output snaps.
 
For the year 2016 ,  the Matrix shows the value as "646" and the bar chart value as "646", both are same.
 
vdineshya_0-1765433433930.png

 

For the year 2017 ,  the Matrix shows the value as "624" and the bar chart value as "624", both are same.

 

vdineshya_1-1765434262769.png

 

 If you want , i will share .PBIX file.

 

I hope this information helps. Please do let us know if you have any further queries.

 

Regards,

Dinesh

 

View solution in original post

9 REPLIES 9
v-dineshya
Community Support
Community Support

Hi @jwdal ,

Thank you for reaching out to the Microsoft Community Forum.

 

As you mentioned in your query, you want the graph to show values as displayed in the matrix.

 

Please refer below DAX measure.

 

Net Sales (Top10 Customers Selected) =
VAR N = 10
VAR ExcludeCustomer = "OXYCHEM"

VAR TopCustomersTable =
    TOPN(
        N,
        FILTER(
            SUMMARIZE(
                ALLSELECTED(AC_ALL),            
                AC_ALL[Top10],                
                "CustomerSales", [Net_Sales]    
            ),
            AC_ALL[Top10] <> ExcludeCustomer
        ),
        [CustomerSales],
        DESC
    )

VAR TopCustomersSingleColumn =
    SELECTCOLUMNS(TopCustomersTable, "Cust", AC_ALL[Top10])

RETURN
CALCULATE(
    [Net_Sales],
    KEEPFILTERS(
        TREATAS(TopCustomersSingleColumn, AC_ALL[Top10])
    )
)
 
Please refer below output snaps.
 
For the year 2016 ,  the Matrix shows the value as "646" and the bar chart value as "646", both are same.
 
vdineshya_0-1765433433930.png

 

For the year 2017 ,  the Matrix shows the value as "624" and the bar chart value as "624", both are same.

 

vdineshya_1-1765434262769.png

 

 If you want , i will share .PBIX file.

 

I hope this information helps. Please do let us know if you have any further queries.

 

Regards,

Dinesh

 

Hi @jwdal ,

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.

 

Regards,

Dinesh

Hi @jwdal ,

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.

 

Regards,

Dinesh

jwdal
Frequent Visitor

Close.  The sum of the bar graph values should total 623.9874

 

 

jwdal_0-1765305300560.png

 

@jwdal the difference may come from the fact that the column "Top10" is different regarding the filter context compared to your measure.

 

Check if this is the difference and let us know.

jwdal
Frequent Visitor

No I want the graph to show business group but the total for all of the business group bars should be what's showing up in the matrix.

Hi @jwdal,

 

ok got it, then I think you just need to add the "top ten" column as a visual filter and select as filter type "Top N" and then 10. See the screenshot below.

Mauro89_0-1765296314251.png

 

Hope this is what you are searching for?

@jwdal if this solved you issue, feel free to mark the post as solution 😊

Mauro89
Super User
Super User

Hi @jwdal,

 

you mean like this?

Mauro89_0-1765292000200.png

 

Best regards!

PS: If you find this post helpful consider leaving kudos or mark it as solution

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors