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
George2323
Frequent 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.

 

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
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.

Top Solution Authors