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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
sdgiss
Helper I
Helper I

Assign value from lookup table when no data is present

Hello PBI Community!

 

I have what I think is a simple question but as of yet have not been able to produce the appropriate outcome. 

 

I have a date table, a fact table, and a lookup table. The lookup table has daily standards (goals) that I will be using to compare to the actual daily output. On the days when I don't have data for an individual it does not report the goal for that day (Individual 4, below). As you would guess, I would like to report the goal even if they don't have data. 

 

Any guidance would be much appreciated!

 

Steve

 

 Daily report                                                                         dTrainMatch

Screen Shot 2021-03-17 at 2.09.49 PM.pngScreen Shot 2021-03-17 at 2.10.22 PM.png 

 

 

 

 

 

Goal Dist =
VAR sumgoaldist =
    SUMX (
        fDataReference,
        LOOKUPVALUE (
            dTrainMatch[Goal-Dist],
            dTrainMatch[Date], RELATED ( dDateSeason[Date] )
        )
    )
RETURN
    IF (
        [Total Dist] = BLANK (),
        sumgoaldist * [Top 10 Avg Dist],
        sumgoaldist * [Top 10 Avg Dist]
    )

4 REPLIES 4
Anonymous
Not applicable

@sdgiss 

 

Before trying to write anything... everyone who is new to DAX should read this: Understand star schema and the importance for Power BI - Power BI | Microsoft Docs

 

After that, it should be easier for you to understand where you go wrong... Please always remember that "not everything that can be done should be done."

Thank you for sending along this reference @Anonymous. I've read it before, but I think it would be worth reading it again.

 

Also, your saying fits my situation. I ended up finding a solution to my problem and it had little resemblence to what I posted above. The IF statement has been removed.

Anonymous
Not applicable

The IF in the measure is totally useless. Since both expressions return the same thing, what does it do?

Thank you for the response, @Anonymous,. When you're as new as I am to DAX bad code means that one is desperate to find a solution and will make silly mistakes along the way. I am just trying to find a solution to my problem.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.