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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Thunders
Frequent Visitor

DAX formula

Hello team,

I have following sititation:

I have 2 tables, I need to create 3rd table.

Using DAX summarize function I get product unique values (see required Output), but I'm strugling to bring quotas, sales and calclate attainments. Example below: 

BI Question.png

Any help appreciated!

Thank you! 🙂

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @Thunders ,

 

try to:

1) add a calculated product table like:

Product = VALUES(sales[Product])

 

2) relate product[product] with sales[product] and quotas[product]

 

3) plot a table visual with product[product] and three measures like:

@sales = SUM(sales[Sales])
@Quotas = SUM(quotas[Quotas])
Attainment% = DIVIDE([@sales], [@Quotas]) 


it worked like:

FreemanZ_2-1701230617484.png

 

FreemanZ_3-1701230635702.png

 

View solution in original post

8 REPLIES 8
FreemanZ
Super User
Super User

hi @Thunders ,

 

try to:

1) add a calculated product table like:

Product = VALUES(sales[Product])

 

2) relate product[product] with sales[product] and quotas[product]

 

3) plot a table visual with product[product] and three measures like:

@sales = SUM(sales[Sales])
@Quotas = SUM(quotas[Quotas])
Attainment% = DIVIDE([@sales], [@Quotas]) 


it worked like:

FreemanZ_2-1701230617484.png

 

FreemanZ_3-1701230635702.png

 

Works perfect! Thank you so much! 🙂

Thunders
Frequent Visitor

Somehow still it is giving me hard time...se below.

Thunders_0-1701197912997.png

 

Thunders
Frequent Visitor

Thunders_0-1701191793585.png

Since I can't established relationship for products between Quotas and Sales table I created new table with unique product values. Works well for Quotas/Sales, but not for table 3 (no idea why)

Thunders_1-1701191903647.png

 

 

hi, @Thunders 

try below

Table 3 = 
var a = CALCULATE(sum(quotas[quotas]))
var b = CALCULATE(SUM(sales[sales]),CROSSFILTER(sales[product],product_type[product],4))
return
ADDCOLUMNS(
      SUMMARIZE(
        quotas,
        quotas[product]
      ),
      "quotas",a
,"sales",b,
"attainments",b/a
)
Thunders
Frequent Visitor

Thank you Dangar,

Just one little issue. The sales are the same for all products even thou I established relationship between tables.

HI, @Thunders 

use relation ship like below 

Dangar332_0-1701190543344.png

 

Dangar332
Super User
Super User

hi, @Thunders 

try below code

Table 3 = 
ADDCOLUMNS(
      SUMMARIZE(
        quotas,
        quotas[product]
      ),
      "r",CALCULATE(sum(quotas[quotas]))
,"sales",CALCULATE(SUM(sales[sales])),
"attainments",CALCULATE(SUM(sales[sales]))/CALCULATE(sum(quotas[quotas])))

 

Dangar332_0-1701186670270.png

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

July Newsletter

Fabric Community Update - July 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors