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

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.

Reply
pacifist
Helper I
Helper I

DAX to pull related table artifact's NAME based on TYPE

Hi,

 

struggling with DAX, as everytone else 😉

 

Imagine having a single table of activities for each artifact type ... looks like this

Activity

ArtifactType

ArtifactId
ViewReportReport1
ViewReportReport1
DeleteReportReport2
UpdateDatasetDataset1
CreateDataflowDataflow1

 

and then there are 3 different tables for each artifact type

Reports:

ReportIdReportName
1ReportA
2ReportB
......

 

Datasets

DatasetIdDatasetName
1DatasetA
......


Dataflows:

DaflowIdDataflowName
1DataflowA
...

...

 

All table have their relationships setup with the activity table, and are INACTIVE.

Now, what would the DAX look like for the measure that will return the related artifact's NAME in the ACTIVITY_TABLE? 
e.g.:

ActivityArtifactTypeArtifactIdName
ViewReportReport1ReportA
ViewReportReport1ReportA
DeleteReportReport2ReportB
UpdateDatasetDataset1DatasetA
CreateDataflowDataflow1DataflowA


Thank you!

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @pacifist 
Please try the following calculated column

Name =
SWITCH (
    Activities[ArtifactType],
    "Report",
        MAXX (
            FILTER ( Reports, Reports[ReportId] = Activities[ArtifactId] ),
            Reports[ReportName]
        ),
    "Dataset",
        MAXX (
            FILTER ( Reports, Reports[DatasetId] = Activities[ArtifactId] ),
            Reports[DatasetName]
        ),
    "Dataflow",
        MAXX (
            FILTER ( Reports, Reports[DataflowId] = Activities[ArtifactId] ),
            Reports[DataflowName]
        )
)

View solution in original post

1 REPLY 1
tamerj1
Super User
Super User

Hi @pacifist 
Please try the following calculated column

Name =
SWITCH (
    Activities[ArtifactType],
    "Report",
        MAXX (
            FILTER ( Reports, Reports[ReportId] = Activities[ArtifactId] ),
            Reports[ReportName]
        ),
    "Dataset",
        MAXX (
            FILTER ( Reports, Reports[DatasetId] = Activities[ArtifactId] ),
            Reports[DatasetName]
        ),
    "Dataflow",
        MAXX (
            FILTER ( Reports, Reports[DataflowId] = Activities[ArtifactId] ),
            Reports[DataflowName]
        )
)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.