Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Get a Value from a Table in Direct Query Mode

Hi experts,

 

I've just started using Power BI.

Would you have suggestions on how to get a value from a table?

I've been unsuccessful in finding the answer from the net.

 

For example, I've got a date table which gets updated daily.  It has a number column flags to identify the business' current date, current MTD %, current YTD %, weekdays, holidays and more.

Is it possible to get the MTD % of the current business day?  Like getting a value based on a condition? 

 

Cheers,

- Louis

  • Hi Anonymous,

    Please try create measure using the formulas below. The MTD % is a column, please use the following formula.

    selected value=CALCULATE (
        FIRSTNONBLANK ( Table[MTD %], Table[MTD %] ),
        FILTER ( Table, Table[Date] = [current date] )
    )

    The MTD % is a measure, please use the formula below.

     

    select_value=CALCULATE ( [MTD %], FILTER ( Table, Table[Date] = [current date] ) )

     

    Notice, I assume the name of measure to get current data as 'current date'.

    Best Regards,
    Angelia

1 Reply

  • v-huizhn-msft's avatar
    v-huizhn-msft
    Microsoft Employee

    Hi Anonymous,

    Please try create measure using the formulas below. The MTD % is a column, please use the following formula.

    selected value=CALCULATE (
        FIRSTNONBLANK ( Table[MTD %], Table[MTD %] ),
        FILTER ( Table, Table[Date] = [current date] )
    )

    The MTD % is a measure, please use the formula below.

     

    select_value=CALCULATE ( [MTD %], FILTER ( Table, Table[Date] = [current date] ) )

     

    Notice, I assume the name of measure to get current data as 'current date'.

    Best Regards,
    Angelia