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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.