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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
1001
Resolver II
Resolver II

Help creating a table from other tables.

Hi All, every DAX example I find on the web is not working. I have three tables:

  1. tbl_Date (col: Date)
  2. tbl_Delivered (col: Del qty)
  3. tbl_Forecast (col: Fcst qty)

 

Step 1 - bring these columns together into a virtual table.

Step 2 - add 3 calculated columns

 

  1. Del qty - Del fcst = variance
  2. Variance / Del fcst = Variance %
  3. ABS (Variance)

 

The reason I'm doing this is because the Matrix table I'm using isn't correctly totalling the ASB Var column. The ABS Var column is giving me the same total result as the Variance column. This is the only way I can figure to resolve the issue. 

 

Thanks All if you can help. 

 

 

8 REPLIES 8
Ashish_Mathur
Super User
Super User

Hi,

You should create additional dimension tables (just like you have the Date table) and create relationships (Many to One and Single) from your 2 Fact tables to the newly created dimension tables.  To your visual, drag fields from the dimension tables to visuals/slicers/filters.  These simple measures should then work

DQ = sum(tbl_delivered[Del qty])

FQ = sum(tbl_Forecast[Fcst qty])

Variance = [DQ]-[FQ]

Variance % = divide([variance],[FQ])

ABS variance = if([variance]<0,-[variance],[variance])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish,

 

I had in place your suggested relational structure. Applying your ABS Variance DAX changed the Varianbce to positive values but the total is still summing the same the Variance Total. 

1001_0-1668050638228.png

The ABS Variance should be a much higher value. This is where I'm having issue.  Thanks.

 

Share the download link of your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Sorry Ashish, this is company info, I would be prohibited from making it available. But below is what I'm encountering using a Matrix table. You can see the bottom Totals row, the Var and ABS Var are exactly the same number at 3,846 where the ABS Var total should be 14,530.

1001_0-1668052250788.png

 




Try this measure

ABS var_new = SUMX(VALUES(Data[Product]),[ABS var])

Replace Data[Product] with the table and column name which you have dragged to the row labels of the matrix.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks Ashish,  but the issue with this formula is the Var number is a Measure, not a calculated column which SUMX needs to perform. And the Qty Del and Qty Fcst columns live in two separate tables. This is the mess I've run into. Thx.

I cannot help witthout a file.  Simple.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish, am creating a duplicate dummy PBI file. Will upload it tomorrow. Many thanks for your help. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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