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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Ion_Ander
Helper I
Helper I

two USERELATIONSHIP in same dax formula

Hi,

First i try to explain what i have:
i have a suppliers table(proveedores), that is related to an invoices table(ALBARANES PROVEEDOR), which is related to an invoice details table (LINEAS ALBARANES PROVEEDOR), and that is related to a products table(ARTICULOS).

 

relacion.jpg

 

The question is that now i need to obtain the purchases that we have made of products from the selected supplier (by vat number) made to another supplier (say vat number 1).

For this i have created another inactive relationship between products and supplier (all products belong to a supplier and in the products table it is specified to which supplier they belong), then i manage to obtain all the purchases made of products from the selected supplier, with the userelationship function.

 

Ion_Ander_0-1637846126045.png

 

 

The problem is: i do not know how to show exclusively purchases made to the supplier with vat 1 number of the products . I think perhaps i will need a second USERELATIONSHIP, but if i try to put it get no result.

 

The formula i try:

 

MyFormula =
VAR SEL =
    SELECTEDVALUE ( PROVEEDOR[NIF] )
VAR RESULT =
    CALCULATE (
        SUM ( 'LINEAS ALBARAN PROVEEDOR'[IMPORTELIMPIO] ),
        ALL ( PROVEEDOR ),
        USERELATIONSHIP ( ARTICULOS[CLAVE PROVEEDOR], PROVEEDOR[clave_PROV] ),
        PROVEEDOR[NIF] = SEL
    )
RETURN
    RESULT

 

 

3 REPLIES 3
v-yalanwu-msft
Community Support
Community Support

Hi, @Ion_Ander ;

Can you post sample data as text and expected output?
Not enough information to go on;

please see this post regarding How to Get Your Question Answered Quickly:
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.


amitchandak
Super User
Super User

@Ion_Ander , does that mean product vat1 in not sold by any other supplier in the selected duration ? Only supplier one sold it ?

what all is selected/filtered 

 

 

example product with only one supplier

countx(filter(Invoicedetails, Product[Product],"_1" ,distinctcount(Invoicedetails[Supplier_id]), [_1] =1), [Product])

 

we need to use all(Supplier) if supplier is selected

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

Thanks for answering, @amitchandak 

 

No, vat1 is not a product, vat is the  acronym of Value Added Tax or identification fiscal number for a supplier.

 

What i need is show me the amount of products buyed to a provider 1 (with VAT number 1--in my case VAT=NIF),but  only the products that belong to the selected supplier.

For Example If i select NIF : "A08002883" i need to show me the amount of products buyed to provider with NIF "1" and the product belong to provider "A08002883". The provider who i buy the products (NIF="1") is a constant, and the provider of the product is variable(the selected one).

 

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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