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.
Trying to convert this to powerbi and I keep getting different numbers.
SQL:
,SUM(CASE WHEN (ISNULL(qi.warrantyflag,'') = 'Y' OR ISNULL(qi.osi_leasedflag,'') = 'Y') AND ISNULL(q.contype,'') <> 'CCO' THEN qi.qty*price
ELSE 0
END) Recurring
PowerBI (What I have so far):
Recurring =
Calculate(
sumx (QuoteItem,QuoteItem[QTY]*QuoteItem[PRICE]),
filter( Quote, isblank(Quote[CONTYPE]) || Quote[CONTYPE] <> "CCO"),
filter( QuoteItem, isblank(QuoteItem[WARRANTYFLAG]) || QuoteItem[WARRANTYFLAG] = "Y" ||isblank(QuoteItem[OSI_LEASEDFLAG]) || QuoteItem[OSI_LEASEDFLAG] ="Y")
)
This stuff makes my head hurt some times.
Solved! Go to Solution.
This has gotten me really close but what I'm having trouble figuring out is the CCO column is on a different table ('quote' instead of 'quoteitem') so I'm getting an error when trying to filter against being CCO. If that makes sense.
Tried to use "related" but not sure if I'm doing that right.
Recurring2 = CALCULATE(
SUMX(
'QuoteItem',
'QuoteItem'[QTY]*'QuoteItem'[PRICE]) ,
FILTER('QuoteItem',
AND(
OR ('QuoteItem'[WARRANTYFLAG]="Y" ,'QuoteItem'[OSI_LEASEDFLAG]="Y")
,related(quote[contype])<>"CCO"
)
))
Hi @qwaszx55,
Tried to use "related" but not sure if I'm doing that right.
Recurring2 = CALCULATE(
SUMX(
'QuoteItem',
'QuoteItem'[QTY]*'QuoteItem'[PRICE]) ,
FILTER('QuoteItem',
AND(
OR ('QuoteItem'[WARRANTYFLAG]="Y" ,'QuoteItem'[OSI_LEASEDFLAG]="Y")
,related(quote[contype])<>"CCO"
)
))
Yes, the related function is correctly used here.
Do you still have any question on this issue? if not, could you accept your reply above as solution to close this thread?
Regards
Hi Experts,
COULD you please help me out with SQL to DAX
SELECT sc.NET_PRICE,c.start_date,c.end_date
from [FACT].[SALES] SC INNER JOIN [DIM].[contract] c ON sc.sales_contract = c.ID,
(
select
d.DATEID ,
d.PER_NAME_YEAR,
d.PER_NAME_QTR,
d.CALENDAR_DATETIME,
d.CAL_MONTH,
d.CAL_QTR,
d.CAL_YEAR,
d.LAST_DAY_CAL_YEAR_FLG,
d.LAST_DAY_CAL_QTR_FLG ,
d.LAST_DAY_CAL_MNTH_FLG
from [oracle_edw_dev].[W_DAY_D] d
where 1=1
and d.LAST_DAY_CAL_QTR_FLG ='Y'
and d.CALENDAR_DATETIME <= GETDATE()
and d.CAL_QTR = '1' and d.CAL_YEAR = 2018
)qtr
where 1=1
and qtr.DATEID >= c.[start_date] and qtr.DATEID <=c.[end_date]
and c.[created_date] <= qtr.CALENDAR_DATETIME
and qtr.DATEID = c.[start_date]
Thanks in Advance
Hi Experts,
COULD you please help me out with SQL to DAX
SELECT sc.NET_PRICE,c.start_date,c.end_date
from [FACT].[SALES] SC INNER JOIN [DIM].[contract] c ON sc.sales_contract = c.ID,
(
select
d.DATEID ,
d.PER_NAME_YEAR,
d.PER_NAME_QTR,
d.CALENDAR_DATETIME,
d.CAL_MONTH,
d.CAL_QTR,
d.CAL_YEAR,
d.LAST_DAY_CAL_YEAR_FLG,
d.LAST_DAY_CAL_QTR_FLG ,
d.LAST_DAY_CAL_MNTH_FLG
from [oracle_edw_dev].[W_DAY_D] d
where 1=1
and d.LAST_DAY_CAL_QTR_FLG ='Y'
and d.CALENDAR_DATETIME <= GETDATE()
and d.CAL_QTR = '1' and d.CAL_YEAR = 2018
)qtr
where 1=1
and qtr.DATEID >= c.[start_date] and qtr.DATEID <=c.[end_date]
and c.[created_date] <= qtr.CALENDAR_DATETIME
and qtr.DATEID = c.[start_date]
Thanks in Advance
Could you Please help me out My SQL to DAX
SELECT sc.NET_PRICE,c.start_date,c.end_date
from [FACT].[SALES] SC INNER JOIN [DIM].[contract] c ON sc.sales_contract = c.ID,
(
select
d.DATEID ,
d.PER_NAME_YEAR,
d.PER_NAME_QTR,
d.CALENDAR_DATETIME,
d.CAL_MONTH,
d.CAL_QTR,
d.CAL_YEAR,
d.LAST_DAY_CAL_YEAR_FLG,
d.LAST_DAY_CAL_QTR_FLG ,
d.LAST_DAY_CAL_MNTH_FLG
from [oracle_edw_dev].[W_DAY_D] d
where 1=1
and d.LAST_DAY_CAL_QTR_FLG ='Y'
and d.CALENDAR_DATETIME <= GETDATE()
and d.CAL_QTR = '1' and d.CAL_YEAR = 2018
)qtr
where 1=1
and qtr.DATEID >= c.[start_date] and qtr.DATEID <=c.[end_date]
and c.[created_date] <= qtr.CALENDAR_DATETIME
and qtr.DATEID = c.[start_date]
Thanks in Advance
Hi @qwaszx55,
Have you tried the solution provided above? Does it work in your scenario? If it works, could you accept it as solution to close this thread?
If you still have any question on this issue, feel free to post here.
Regards
This has gotten me really close but what I'm having trouble figuring out is the CCO column is on a different table ('quote' instead of 'quoteitem') so I'm getting an error when trying to filter against being CCO. If that makes sense.
Tried to use "related" but not sure if I'm doing that right.
Recurring2 = CALCULATE(
SUMX(
'QuoteItem',
'QuoteItem'[QTY]*'QuoteItem'[PRICE]) ,
FILTER('QuoteItem',
AND(
OR ('QuoteItem'[WARRANTYFLAG]="Y" ,'QuoteItem'[OSI_LEASEDFLAG]="Y")
,related(quote[contype])<>"CCO"
)
))
Hi @qwaszx55,
Tried to use "related" but not sure if I'm doing that right.
Recurring2 = CALCULATE(
SUMX(
'QuoteItem',
'QuoteItem'[QTY]*'QuoteItem'[PRICE]) ,
FILTER('QuoteItem',
AND(
OR ('QuoteItem'[WARRANTYFLAG]="Y" ,'QuoteItem'[OSI_LEASEDFLAG]="Y")
,related(quote[contype])<>"CCO"
)
))
Yes, the related function is correctly used here.
Do you still have any question on this issue? if not, could you accept your reply above as solution to close this thread?
Regards
Hi @qwaszx55
I think this might be close...
Measure = CALCULATE( SUMX( 'qi', 'qi'[qty]*'qi'[price]) , FILTER('qi', AND( OR ('qi'[warrantyflag]="Y" ,'qi'[osi_leasedflag]="Y") ,'qi'[contype]<>"CCO") ) )
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |