Forum Discussion
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]))
What will be the dax to show correct Column Total in Matrix table
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
22 Replies
- grazitti_sapna
Super User
Hi maamirkhan2023,
Issue with your DAX is
SUMX(__table, [__value])— This is referencing a column[__value]that doesn't actually exist outside theSUMMARIZE. You're not creating a real column called__value, andSUMXdoesn’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!- maamirkhan2023
Helper I
Still same issue as above screenshot
- grazitti_sapna
Super User
Hi maamirkhan2023,
Let's try other ways to fix it,
Instead of
COUNT()orDISTINCTCOUNT()directly, wrap it inside SUMX for row-level precisionCorrect 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
- v-dineshya
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.
2. In Power Query editor, I have done trasformation on month columns (Unpivot columns from Jan to july). Please refer below snap.
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]))RETURNIF(HASONEVALUE('Host_Detections'[Asset Tags]),SUM('Host_Detections'[DetectionCount]),SUMX(SummaryTable, [Cnt]))4. Please refer output snap and attached PBIX file.I hope this information helps. Please do let us know if you have any further queries.
Regards,
Dinesh
- v-dineshya
Community Support
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
- v-dineshya
Community Support
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
- Ashish_Mathur
Super User
Hi,
Share the download link of the PBI file.