cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
George2323
Regular Visitor

DAX GENERATE ROW Results...How Do I Sum the Column of a "Generated Virtual" table?

Hi I am using Dax Studio and I have figured out how to get the calculation I need in the Output section of DAX Studio, but the output is in the form of a table.  I just need the sum of the column generated by using GENERATE and ROW.

 

I need the column in the red circle summed as that is the value I want for the metric in PowerBI. 

 

I have tried everything I can think of...new to DAX....searched high and low.  Just don't seem to be able to reference the "generated" table with any commands outside of the GENERATE ROW.

 

DAX 4-17-2021 10-16-34 AM.png

1 ACCEPTED SOLUTION
daxer-almighty
Solution Sage
Solution Sage

 

// Very easy in fact...
// After the last RETURN
// you have to do:

sumx(
    DOHTable,
    [DOH]
)

// But I can't see a reason to use
// GENERATE for this when just
// ADDCOLUMNS would suffice or even
// just calculations on the fly under SUMX.
// For the calculation of the sum,
// of course, all the columns apart
// from DOH are not needed. By the way,
// the DAX standard is that all columns
// which are calculated in a measure/query
// should start with "@". Just to be able
// to differentiate them from physical columns
// and measures.

 

View solution in original post

3 REPLIES 3
daxer-almighty
Solution Sage
Solution Sage

 

// Very easy in fact...
// After the last RETURN
// you have to do:

sumx(
    DOHTable,
    [DOH]
)

// But I can't see a reason to use
// GENERATE for this when just
// ADDCOLUMNS would suffice or even
// just calculations on the fly under SUMX.
// For the calculation of the sum,
// of course, all the columns apart
// from DOH are not needed. By the way,
// the DAX standard is that all columns
// which are calculated in a measure/query
// should start with "@". Just to be able
// to differentiate them from physical columns
// and measures.

 

View solution in original post

Yes. That worked. This wins a battle, but probably not the war on this project. I know there is a better way to do it, but this way was shown for "days of cover" by 2 DAX VIPs. You have to iterate through several weeks for a proper days on hand. 

Well, I would easily dare question their VIP-ness, LoL :)))

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are You Ready?

Test your skills now with the Cloud Skills Challenge.

Top Solution Authors