DAX Userelationship function

0 votes

I have this issue with the Userelationship function in DAX. I have two Tables. The 2 tables are linked from SkuCampaign1SkuCampaign2SkuCampaign3 in the SalesFact to the SkuCampaign from the DimPromoSkus.

My goal is to calculate Promoted Sales on each Campaign C1, C2, and C3. Of course, this could be done with a lookup column and then calculate the Sales where that key was found BUT I would like to use the USERELATIONSHIP function

Can someone tell me how to calculate that?

Oct 5 in Power BI by Rajiv
• 4,960 points
40 views

1 answer to this question.

0 votes

 You need a way for the measure to apply a filter context to the sum. You don't need to explicitly supply a value though. You can simply pass in the DimPromoSkus table as the filter context.

PromoSalesC1 =
    CALCULATE(
        SUM(SalesFact[Sales]),
        DimPromoSkus,
        USERELATIONSHIP(SalesFact[SkuCampaign1], DimPromoSkus[SkuCampaign])
    )

Remember that the CALCULATE function can take tables as filter arguments. Here, we provide DimPromoSkus as the filter so that we don't sum any values that don't flow through the specified relationship. So, for example, since A3 C1 isn't in DimPromoSkus, the corresponding row in SalesFact doesn't get included in the sum.

answered Oct 5 by Gitika
• 50,620 points

Related Questions In Power BI

0 votes
1 answer

Calculate and filter function - DAX

Hi Praneeth, Calculate () by default perform calculations ...READ MORE

answered May 2, 2019 in Power BI by Cherukuri
• 32,490 points
272 views
0 votes
1 answer

DAX function to create LY Measure without date dimension

It should be fairly simple (sumx of ...READ MORE

answered Oct 1 in Power BI by Gitika
• 50,620 points
39 views
0 votes
1 answer

How do I use the DAX function ParallelPeriod?

The DAX expression you used in the ...READ MORE

answered Oct 5 in Power BI by Gitika
• 50,620 points
41 views
0 votes
1 answer

Power Bi Dax Table

You need to wrap the numbers in ...READ MORE

answered Oct 5, 2018 in Power BI by Kalgi
• 51,970 points
281 views
0 votes
1 answer
0 votes
1 answer

Understanding the DAX CALCULATE function

Using the CALCULATE function makes the DAX perform a context ...READ MORE

answered Sep 28 in Power BI by Gitika
• 50,620 points
55 views
0 votes
1 answer

DAX EARLIER() function in Power Query

Solutions in the code below. Notice that ...READ MORE

answered Oct 1 in Power BI by Gitika
• 50,620 points
105 views
0 votes
1 answer

How do I label bar graph with different colors based on values from different slicers?

If the user selects only one value ...READ MORE

answered May 20, 2019 in Power BI by avantika
• 1,500 points
225 views
0 votes
1 answer

Using RELATED function in DAX with USERELATIONSHIP

Here's an example using the AdventureWorksDW data ...READ MORE

answered Nov 17 in Power BI by anonymous
• 50,620 points
16 views
0 votes
1 answer

DAX Calculate function with and without FILTER

You could make [Measure12] return the same results as ...READ MORE

answered Sep 24 in Power BI by Gitika
• 50,620 points
101 views