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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
rxt
Helper I
Helper I

Return table with condition function

DAX conditional functions such as IF SWITCH RETURNS scalar value.

I am converting SSRS reports to Paginated Report and publishing in powerBI Report Server(PBIRS) using PowerBI Dataset. I am passing two parameters not tie to dataset table. example from dax studio. 

1. first parameter has the list and 2. parameter has the lanlogin. 

 

if lanlogin is found in the list different table values needed to be return otherwise another table values needed to be return. Like below, since limitation of IF SWITCH conditional DAX function I couldn't achieve what I was looking for example below:

 

DEFINE
var _SecurityList = row("HasAccess",@HasAccess)
var _IsMGR = if(ISBLANK(FILTER(_SecurityList, search(LEFT(RIGHT(@LanLogin,len(@LanLogin)-9),len(@LanLogin)-1),[HasAccess],1,0) >= 1)),"0","1")

if(ROW("fullAccess",_IsMGR)="1", table1, table2)

where table1 and table2 are from dataset and can be manipulated.

 

is there some idea  if this can be achievable in DAX so that I can return table or at least 1 columns with multiple rows using combination of table return functions and conditional functions.

 

 

 

1 ACCEPTED SOLUTION

Many thanks Greg, that did the trick to me. Appriciated your Assistance

View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

@rxt If they have the same number of columns you could do this:

Table 2 = 
    VAR __table1 = 'Table5'
    VAR __table2 = 'Table6'
    VAR __truefalse = IF(TRUE(),1,2)
    VAR __table1a = ADDCOLUMNS(__table1,"truefalse",__truefalse)
    VAR __table2a = ADDCOLUMNS(__table2,"truefalse",__truefalse)
    VAR __table1b = EXCEPT(__table1a,FILTER(__table1a,[truefalse]=1))
    VAR __table2b = EXCEPT(__table2a,FILTER(__table2a,[truefalse]=2))
RETURN
    UNION(__table1b, __table2b)


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Many thanks Greg, that did the trick to me. Appriciated your Assistance

You appear to have marked your response to the answer as the accepted answer. I don't know if it's too late, but you should mark his answer as the solution so that he gets credit for it.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.