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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply

Incorrect Column Totals in Matrix showing

Hi All 

Incorrect Column Totals in Matrix showing 

Here is the dax I have used still showing 
Incorrect Column Totals in Matrix showing 

VAR __table = SUMMARIZE(Q_Host_List_Detection_HOSTS,"__value",count(Q_Host_List_Detection_HOSTS[IP]))

RETURN
IF(HASONEVALUE(Q_Host_List_Detection_HOSTS[Asset Tags]),count(Q_Host_List_Detection_HOSTS[IP]),SUMX(__table,[__value]))

Screenshot 2025-07-10 173902.png

What will be the dax to show correct Column Total in Matrix table
 

 

1 ACCEPTED SOLUTION

Hi @maamirkhan2023 ,

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot). Do not include sensitive information. Do not include anything that is unrelated to the issue or question. Please show the expected outcome based on the sample data you provided. If possible please provide sample PBIX file.


Regards,
Dinesh

View solution in original post

22 REPLIES 22
Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-dineshya
Community Support
Community Support

Hi @maamirkhan2023 ,

Thank you for reaching out to the Microsoft Community Forum.

Please follow below steps.

 

1. Created sample data based on your screenshot. please refer below.

 

vdineshya_0-1752209713301.png

 

2. In Power Query editor, I have done trasformation on month columns (Unpivot columns from Jan to july). Please refer below snap.

 

vdineshya_1-1752209845945.png

 

3. Created measure "Detection Count" with below DAX code.

 

Detection Count =
VAR SummaryTable =
    SUMMARIZE(
        'Host_Detections',              
        'Host_Detections'[Asset Tags],
        "Cnt", SUM('Host_Detections'[DetectionCount])
    )
RETURN
IF(
    HASONEVALUE('Host_Detections'[Asset Tags]),
    SUM('Host_Detections'[DetectionCount]),
    SUMX(SummaryTable, [Cnt])
)
 
4. Please refer output snap and attached PBIX file.
 
vdineshya_2-1752210001863.png

 

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

 

Regards,

Dinesh

Hi @maamirkhan2023 ,

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 @maamirkhan2023 ,

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 @maamirkhan2023 ,

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

same Issue I already replied 

Hi @maamirkhan2023 ,

You are getting incorrect column totals in Matrix. In my response , I have provide screenshot and PBIX file, please refer below snap, it will show the correct column totals in Matrix.

 

vdineshya_0-1753194410086.png

 

For example ,if we consider "Tag1"  from "January" to "July" , the column total value is "843".

17+717+6+50+24+11+18= 843. I think this is your expected output. 

 

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

 

Regards,

Dinesh

I try this Dax  and your dax but same issue 

VAR SummaryTable =
    SUMMARIZE(
        'Q_Host_List_Detection_HOSTS',              
       Q_Host_List_Detection_HOSTS[Asset Tags],
        "Cnt", DISTINCTCOUNT(Q_Host_List_Detection_HOSTS[IP])
    )
RETURN
IF(
    HASONEVALUE(Q_Host_List_Detection_HOSTS[Asset Tags]),
    DISTINCTCOUNT(Q_Host_List_Detection_HOSTS[IP]),
    SUMX(SummaryTable, [Cnt])
)

Screenshot 2025-07-23 001112.png

Hi @maamirkhan2023 

Once again i am sending the PBIX file . Please check the file.

 

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

 

Regards,

Dinesh

same issue  incorrect column totals in Matrix. 

Hi @maamirkhan2023 ,

 

Please try below DAX code.

 

VAR SummaryTable =
SUMMARIZE(
'Q_Host_List_Detection_HOSTS',
Q_Host_List_Detection_HOSTS[Asset Tags],
"Cnt", SUM(Q_Host_List_Detection_HOSTS[IP])
)
RETURN
IF(
HASONEVALUE(Q_Host_List_Detection_HOSTS[Asset Tags]),
SUM(Q_Host_List_Detection_HOSTS[IP]),
SUMX(SummaryTable, [Cnt])
)

 

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

 

Regards,

Dinesh

 

 

Not working and I cannot use Sum here as I mention above many times

Hi @maamirkhan2023 ,

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot). Do not include sensitive information. Do not include anything that is unrelated to the issue or question. Please show the expected outcome based on the sample data you provided. If possible please provide sample PBIX file.


Regards,
Dinesh

Table 1 contails Tags and IP
Table 2 contains Date and I joined with ID and created Matrix table

VAR SummaryTable =
    SUMMARIZE(
        'Q_Host_List_Detection_HOSTS',              
       Q_Host_List_Detection_HOSTS[Asset Tags],
        "Cnt"DISTINCTCOUNT(Q_Host_List_Detection_HOSTS[IP])
    )
RETURN
IF(
    HASONEVALUE(Q_Host_List_Detection_HOSTS[Asset Tags]),
    DISTINCTCOUNT(Q_Host_List_Detection_HOSTS[IP]),
    SUMX(SummaryTable[Cnt])
)

Hi @maamirkhan2023 ,

Please provide sample data and  expected output. it will help me to replicate the scenario. without sample data and without expected output, we can't proceed further.

 

Regards,

Dinesh

Yes but Where is PBIX file can you please share again and what will be dax

Where is PBIX file can you please share again

grazitti_sapna
Super User
Super User

Hi @maamirkhan2023,

Issue with your DAX is SUMX(__table, [__value]) — This is referencing a column [__value] that doesn't actually exist outside the SUMMARIZE. You're not creating a real column called __value, and SUMX doesn’t know how to evaluate [__value].

 

You can try this:

 

Correct IP Count =
VAR __table =
SUMMARIZE(
Q_Host_List_Detection_HOSTS,
Q_Host_List_Detection_HOSTS[Asset Tags],
"IPCount", COUNT(Q_Host_List_Detection_HOSTS[IP])
)
RETURN
IF(
HASONEVALUE(Q_Host_List_Detection_HOSTS[Asset Tags]),
COUNT(Q_Host_List_Detection_HOSTS[IP]),
SUMX(__table, [IPCount])
)

 

🌟 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
💡 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
🎖 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
🔗 Curious to explore more? [Discover here].
Let’s keep building smarter solutions together!

Still same issue as above screenshot

Hi @maamirkhan2023,

 

Let's try other ways to fix it,

Instead of COUNT() or DISTINCTCOUNT() directly, wrap it inside SUMX for row-level precision

Correct IP Count =
IF(
HASONEVALUE(Q_Host_List_Detection_HOSTS[Asset Tags]),
CALCULATE(COUNT(Q_Host_List_Detection_HOSTS[IP])),
SUMX(
VALUES(Q_Host_List_Detection_HOSTS[Asset Tags]),
CALCULATE(COUNT(Q_Host_List_Detection_HOSTS[IP]))
)
)

Alternate: DISTINCT IPs per Asset Tag

Correct Distinct IPs =
IF(
HASONEVALUE(Q_Host_List_Detection_HOSTS[Asset Tags]),
DISTINCTCOUNT(Q_Host_List_Detection_HOSTS[IP]),
SUMX(
VALUES(Q_Host_List_Detection_HOSTS[Asset Tags]),
CALCULATE(DISTINCTCOUNT(Q_Host_List_Detection_HOSTS[IP]))
)
)

 

If still it's not working try with this,

 

Correct IP Count =
IF(
ISINSCOPE(Q_Host_List_Detection_HOSTS[Asset Tags]),
COUNT(Q_Host_List_Detection_HOSTS[IP]),
SUMX(
VALUES(Q_Host_List_Detection_HOSTS[Asset Tags]),
CALCULATE(COUNT(Q_Host_List_Detection_HOSTS[IP]))
)
)

 

Mark this as a solution if the issue get's fixed

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.