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, 2020 in Power BI by Rajiv
• 8,910 points
1,087 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, 2020 by Gitika
• 65,890 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
• 33,030 points
1,286 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, 2020 in Power BI by Gitika
• 65,890 points
883 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, 2020 in Power BI by Gitika
• 65,890 points
861 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
• 52,360 points
1,119 views
0 votes
1 answer

Using DAX calculation how to calculate monthly budget till today in power bi Desktop?

You can make use of this: MTD Budget ...READ MORE

answered Sep 24, 2020 in Power BI by Gitika
• 65,890 points
1,795 views
0 votes
1 answer

Understanding the DAX CALCULATE function

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

answered Sep 28, 2020 in Power BI by Gitika
• 65,890 points
1,533 views
0 votes
1 answer

How to restart running total column with Power BI Desktop DAX?

This is not only a running total ...READ MORE

answered Dec 8, 2020 in Power BI by Gitika
• 65,890 points
1,839 views
0 votes
1 answer

DAX EARLIER() function in Power Query

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

answered Oct 1, 2020 in Power BI by Gitika
• 65,890 points
2,812 views
0 votes
1 answer

Using RELATED function in DAX with USERELATIONSHIP

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

answered Nov 18, 2020 in Power BI by anonymous
• 65,890 points
4,855 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, 2020 in Power BI by Gitika
• 65,890 points
3,906 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP