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
Anonymous
Not applicable

hasonefilter on table with measures. totals wrong

Hi,

 

i have a matrix visual based on 2 tables(rows and columns). The values are calculated with a measure. The measure compares a value, if the value is ther it enters acalculated value if not then 0.

 

But even if i use the hasonefilter and sumx approach it doenst count correct. It doesnt count only values that are existing.

 

 

Travelcost = var daycost =if([traveldayinc]+[traveldayrft]>0,Values(Travelfactor[cost])*Values(Travelfactor[faktor]),"0")
return
if(HASONEFILTER('Calendar'[Date]),daycost,sumx('Calendar',daycost))

 

HolDen_0-1603110857312.png

 

How to get only values from the visual as total?

 

Thanks & Regards

9 REPLIES 9
v-kelly-msft
Community Support
Community Support

Hi @Anonymous ,

 

Have you tried @amitchandak 's suggestion?Is your issue solved now?

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

Anonymous
Not applicable

Hi,

 

i tried the approach and played with it around, But always im getting wrong totals.

 

It seems that the Filter of the Visual is ignored.

 

HolDen_0-1603264625811.png

 

 

Regards

 

Hi @Anonymous ,

 

Could you pls upload your .pbix file to onedrive business and share the link with us?

Remember to remove the confidential information.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

Anonymous
Not applicable

Hi,

 

the PBIX is to big and has many other things in it.

 

I also have another open topic zo solve this issue through a virtual table, but this is also not solved.

 

https://community.powerbi.com/t5/Desktop/Calculated-or-Virtual-table-based-on-3-tables/m-p/1441720#M...

 

An example Data model can be simple like that:

HolDen_0-1603343792591.png

 

The measure would be look like:

 

Travelcost = var daycost =if([count(case id)]>0,"1","0")
return
sumx(values('Calendar'[Date]),if(HASONEFILTER('Calendar'[Date]),daycost,sumx('Calendar',daycost)))
 
The purpose is also simple:
if i have more than one case per day put in a fixed cost for that day. This works fine, but not the totals
 
I will generate a simple PBIX 🙂 but need to find some free time to do that.
 
Thanks
 
Anonymous
Not applicable

Hi,

 

i have created an example PBIX.

 

How can i upload it?

 

(The file type (.pbix) is not supported.)

 

Regards

Hi @Anonymous ,

 

Pls upload your sample .pbix file to onedrive business and share the link with us.

 


Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

Anonymous
Not applicable

Hi, thats not possible. External SHaring is disabled in our company.

 

Any other ways to upload the file?

 

Regards

Hi  @Anonymous ,

 

Copy the data and paste it in an editable format.Remember to remove the confidential information.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

amitchandak
Super User
Super User

@Anonymous , Try like

sumx(values('Calendar'[Date]),if(HASONEFILTER('Calendar'[Date]),daycost,sumx('Calendar',daycost)))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors