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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Creating a weighted graph using DAX / COUNT

Hello Power BI community,

 

I am a novice in Power BI DAX syntax writing and am desperate for assistance on a problem at work.

 

Here's the short of it: I have one table which has the RAW data being pulled from Smartsheet. I have a second table I made for a weighted calculation which I cannot figure out how to write.

 

In this other table I made, I'll call it WEIGHTEDTABLE, I have a [Brand] column with text I typed in when I made the table (Brand1, Brand2, etc). Then I have two columns which I would like to populate with a formula. These two other columns are for Item1 and Item2.

 

The reason behind this is I can have a graph with just counts of Item1 and Item2 for each brand, but that is not fair/accurate because some brands have more of an item than another (which is why I want to created a WEIGHTED table).

 

The graph I want to create would have the Brands on the Axis, and the values would be the COUNT of Item1 and Item2 / the appropriate number that I will enter (let's just say it's 25 for Item1 and 10 for Item2).

 

So ideally, it would be a COUNTIF or IF - if [Brand] from the RAW table = [Brand] from the table I entered, then there would be a COUNT of Item1 from the RAW table divided ( / ) by a 25 or 10.

 

That's it! Perhaps there is a much easier way to do this. Anything helps and I really appreciate the time and effort that goes into responses!

1 ACCEPTED SOLUTION
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Based on my understanding, WeightedTable contains fields: [Brand], [Item] and [Weighted Number], RawTable contains [Brand] and [Item].

 

Please create measure as below:

weighted value =
CALCULATE (
    MAX ( 'Weighted Table'[Weighted Number] ),
    FILTER (
        ALL ( 'Weighted Table' ),
        'Weighted Table'[Brand] = SELECTEDVALUE ( 'Raw Table'[Brand] )
            && 'Weighted Table'[Item] = SELECTEDVALUE ( 'Raw Table'[Item] )
    )
)

count item = COUNT('Raw Table'[Item])/'Raw Table'[weighted value]

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Based on my understanding, WeightedTable contains fields: [Brand], [Item] and [Weighted Number], RawTable contains [Brand] and [Item].

 

Please create measure as below:

weighted value =
CALCULATE (
    MAX ( 'Weighted Table'[Weighted Number] ),
    FILTER (
        ALL ( 'Weighted Table' ),
        'Weighted Table'[Brand] = SELECTEDVALUE ( 'Raw Table'[Brand] )
            && 'Weighted Table'[Item] = SELECTEDVALUE ( 'Raw Table'[Item] )
    )
)

count item = COUNT('Raw Table'[Item])/'Raw Table'[weighted value]

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.