DAX query
I am working on powerbi report builder for making a report. I am stuck at a query.
Please help me out in writing a query for this.
Add a new column called 'grantTypeDesc' that will have the descriptive version of grantee[granteeTypeCode].
0
Best Answer
-
marcothesane - Select Field - Administrator
Add a new column - to what? An already existing query? If yes, can you share it?
0
Answers
Yes, add a new column to an existing query.
We need more info to help you:
The place where you find privileges info in the Vertica system catalogue is the
grants
system table:This is a sample entry:
Share the existing query with us, and what kind of info you expect in the grantee type code or its description.
Here is a query -
DEFINE
VAR vFromgrantsgrantdate1 =
DATEVALUE ( @Fromgrantsgrantdate )
VAR vTograntsgrantdate1 =
DATEVALUE ( @Tograntsgrantdate )
MEASURE grants[GrantTotalsByIdCode] =
CALCULATE (
SUM ( grants[grantamt] ),
ALLSELECTED ( grants ),
VALUES ( grants[idcode] )
)
MEASURE grants[GrantYear] =
YEAR ( SELECTEDVALUE ( grants[grantdate] ) )
MEASURE grants[GrantMonth] =
SWITCH (
MONTH ( SELECTEDVALUE ( grants[grantdate] ) ),
1, "January",
2, "February",
3, "March",
4, "April",
5, "May",
6, "June",
7, "July",
8, "August",
9, "September",
10, "October",
11, "November",
12, "December"
)
EVALUATE
CALCULATETABLE (
SUMMARIZECOLUMNS (
grants[grantnum],
grants[grantdate],
grants[idcode],
profile[orgname],
grants[grantamt],
grants[fundid],
grants[action],
grantee[datefirstgrant],
grantee[granteetypecode],
grantee[popcode],
"grantTotalsByIdCode", [GrantTotalsByIdCode],
"grantYear", [GrantYear],
"grantMonth", [GrantMonth]
),
( grants[grantdate] >= DATEVALUE ( vFromgrantsgrantdate1 ) ),
( grants[grantdate] <= DATEVALUE ( vTograntsgrantdate1 ) ),
( grantee[granteetypecode] <> "T" ),
( grants[grantamt] <> 0 )
)
ORDER BY
"grantTotalsByIdCode" DESC,
grants[grantamt],
profile[orgname] DESC