Quantcast
Channel: Developer topics
Viewing all articles
Browse latest Browse all 17899

DAX: to return full table results from unrelated/unjoined table. Sql equivalent uses subquery

$
0
0

 

I need a DAX formula which returns a full table of results, after evaluating a condition between unrelated tables?? 

 

 I have a table unjoined/unrelated to rest of model, and I need to slice it by YYYYMMDD and ToolName, and based on that return everything in the model having same YYYYMMDD and Toolname.   

Equivalent SQL

use Sandbox
go
select AlertName, AppName, o.YYYYMM, a.issuestarttime, a.resolutiontime,LEFT(CONVERT(varchar, issuestarttime,112),6) YYYYMM
from Alerts a
join [dbo].[Alert_application] aset on a.alertid = aset.alertid
join [dbo].[Applications] app on aset.applicationid = app.applicationid
join (
--subquery aka slicer selections
select distinct YYYYMM, Tool from [dbo].LoneTable
  where YYYYMM = 201705 and Tool = 'StrikeOne') o on o.YYYYMM = YYYYMM and app.AppName = o.Tool
where YYYYMM <= O.YYYYMM
and YYYYMM >= O.YYYYMM

 I cannot create a relationship in the model on YYYYMMDD between the LoneTable and the model because YYYYDD isn't unique

 

 

 

I tried Measure = FILTER(ALL(Alerts), CALCULATE(VALUES(LoneTable[DateAsInteger]), FILTER(LoneTable, LoneTable[DateAsInteger] = Alerts[DateAsInteger]))) 

I get error 'a single value for column 'DateAsInteger' in table 'Alerts' cannot be determined....', exactly right, and I want all those values returned!

 

 

Sharing pbix here  https://www.dropbox.com/s/9llrk0am8tgaf2w/LoneTable.pbix?dl=0

 

 Capture.PNG

 

 


Viewing all articles
Browse latest Browse all 17899

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>