web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Run a query against a ...
Power Automate
Unanswered

Run a query against a dataset

(0) ShareShare
ReportReport
Posted on by 10

Hi!

 

Having some troubles with running a query against a dataset. The DAX query returned in Power BI is the one below, however, it's only returning the Date columns (label and sort).

 

// DAX Query
DEFINE
VAR __DS0FilterTable = 
TREATAS({"Show"}, '_Timeline'[_Displayed Ms])
 
VAR __DS0FilterTable2 = 
FILTER(
KEEPFILTERS(VALUES('Company'[type])),
NOT('Company'[type] IN {"PARTNER"})
)
 
VAR __DS0Core = 
SUMMARIZECOLUMNS(
ROLLUPADDISSUBTOTAL(
ROLLUPGROUP('_Deal'[_Forecast Category], '_Deal'[_Forecast Sort]), "IsGrandTotalRowTotal",
'Company'[CompanyName], "IsDM1Total"
),
'_Timeline'[_Date],
'_Timeline'[_Date Sort],
__DS0FilterTable,
__DS0FilterTable2,
"v_Renewal_ARR_disp", '_Deal'[_Renewal ARR disp],
"Minv_Forecast_Category", IGNORE(CALCULATE(MIN('_Deal'[_Forecast Category])))
)
 
VAR __DS0PrimaryWindowed = 
TOPN(
102,
SUMMARIZE(
__DS0Core,
'_Deal'[_Forecast Category],
'_Deal'[_Forecast Sort],
[IsGrandTotalRowTotal],
'Company'[CompanyName],
[IsDM1Total]
),
[IsGrandTotalRowTotal],
0,
'_Deal'[_Forecast Sort],
1,
'_Deal'[_Forecast Category],
1,
[IsDM1Total],
0,
'Company'[CompanyName],
1
)
 
VAR __DS0SecondaryBase = 
SUMMARIZE(__DS0Core, '_Timeline'[_Date], '_Timeline'[_Date Sort])
 
VAR __DS0SecondaryShowAll = 
ADDMISSINGITEMS(
'_Timeline'[_Date],
'_Timeline'[_Date Sort],
__DS0SecondaryBase,
'_Timeline'[_Date],
'_Timeline'[_Date Sort],
__DS0FilterTable,
__DS0FilterTable2
)
 
VAR __DS0Secondary = 
TOPN(102, __DS0SecondaryShowAll, '_Timeline'[_Date Sort], 1, '_Timeline'[_Date], 1)
 
VAR __DS0BodyLimited = 
NATURALLEFTOUTERJOIN(
__DS0PrimaryWindowed,
SUBSTITUTEWITHINDEX(
__DS0Core,
"ColumnIndex",
__DS0Secondary,
'_Timeline'[_Date Sort],
ASC,
'_Timeline'[_Date],
ASC
)
)
 
EVALUATE
__DS0Secondary
 
ORDER BY
'_Timeline'[_Date Sort], '_Timeline'[_Date]
 
EVALUATE
__DS0BodyLimited
 
ORDER BY
[IsGrandTotalRowTotal] DESC,
'_Deal'[_Forecast Sort],
'_Deal'[_Forecast Category],
[IsDM1Total] DESC,
'Company'[CompanyName],
[ColumnIndex]

 

Basically I'd need the raw date out of this table (so what I'm missing is precisely the 'expand' rows portion, i.e. forecast category, the customer names and respective values, cut out in black). Do I need to further define the fields in the query? I've run similar ones and the results are ok. Sorry if I haven't been clear enough, I'm a beginner with Power Automate.

 

ftosnl_0-1703001731469.png

 

Categories:
I have the same question (0)
  • lbendlin Profile Picture
    8,474 Super User 2025 Season 2 on at

    Looks like you copied the DAX query from a matrix visual.  Change the visual to table, remove the row totals, and then copy the DAX again.  It will be much simpler and faster too.

  • ftosnl Profile Picture
    10 on at

    Technically, yes, my bad, it's a matrix, not a table. Is there a way I can continue using the matrix, @lbendlin , as it's part of a management dashboard, and wanted as such?

  • Verified answer
    lbendlin Profile Picture
    8,474 Super User 2025 Season 2 on at

    Make a copy of the visual and trim that copy down to the minimal table. Borrow the DAX and delete the visual.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard