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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
manalla
Helper V
Helper V

Previous day value - SSAS Tabular live connection

Hi,

 

I need to get previous day value and show it in column and then calculate difference between the values.

Below is my data set, which is an aggregated/summarized values from base table. I have many other dimension attributes on same table.

 

So main requirement is to pull previous day outstanding. First three fields are raw, last two are calcualted in below grid.

Power BI report connected to SSAS Tabular live connection.  I am restricted to use only measures and not calculated columns.

 

Formula's currently used :

Previous O/S =
CALCULATE(sum(Data[USDOutstanding]),ALLSELECTED(Data),PREVIOUSDAY(Data[Business_Date]))

PreviousDay_Blank = IF(ISBLANK(PREVIOUSDAY(Data[Business_Date])),1,0)

 

But since holiday/weekend days dates are not avilable on my data, previous day function is not working when it encounters missing date.

I have referred to this blog - https://community.powerbi.com/t5/Desktop/Previous-day-value/m-p/610754#M291094

but when i use EARLIER and use Business_DATE in it, it says Parameter is not correct type (cant find name Business_DATE). So not really sure what i should be using.

 

Any help will be really appreciated.

 

Business_DateCommitmentOutstandingPrevious O/SPreviousDay_Blank
5/18/2020100009567 1
5/19/202010000900095670
5/20/202010000950090000
5/21/202010000960095000
5/22/202010000975096000
5/26/2020100008500 0
5/27/202010000875085000
5/28/2020105001000087500
5/29/2020105009800100000
6/1/20201050010150 1
6/2/20201050010150101500
6/3/20201050010150101500
6/4/20201050010220101500
6/5/2020105008670102200
6/8/2020110009000 1
6/9/202011000950090000
6/10/202011000965095000
6/11/202011000965096500
6/12/202011000965096500
6/15/2020110009650 1

 

Thanks

Manoj

1 ACCEPTED SOLUTION

Hi , @manalla 

Please refer to these related threads.

https://community.powerbi.com/t5/Desktop/Alternative-of-SELECTEDVALUE-DAX-function/m-p/812261

https://community.powerbi.com/t5/DAX-Commands-and-Tips/SELECTEDVALUE-function-doesn-t-recognized/m-p...

 

You can  take a try to use IF + HASONEVALUE combination  to replace the" selectvalue" function in DirectQuery mode.

IF(HASONEVALUE(Table [column]),VALUES(Table [column]))

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-easonf-msft
Community Support
Community Support

Hi , @manalla 

You may check if the following formulas help:

 

Previous O/S measure = 
CALCULATE(
    SUM(Test[Outstanding]),
    FILTER(
        ALL(Test),
        Test[Business_Date]=SELECTEDVALUE(Test[Business_Date])-1
    )
)
flag = 
IF(
    ISBLANK([Previous O/S measure]),
    1,0
)

 

Result = SELECTEDVALUE(Test[Outstanding])-[Previous O/S measure]

 sample file

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Eason @v-easonf-msft 

 

Thanks a lot for your reply.

 

I am using SSAS Live connection. So SELECTEDVALUE function is not working. Even EARLIER function is givnig errors.

I get "SELECTEDVALUE" is not a function.

 

I referred to this Post - https://community.powerbi.com/t5/Desktop/SELECTEDVALUE-not-a-valid-function/td-p/270639 which is an old post. 

 
 

Can you suggest any other alternate for my case?

 

Thanks

Manoj

Hi , @manalla 

Please refer to these related threads.

https://community.powerbi.com/t5/Desktop/Alternative-of-SELECTEDVALUE-DAX-function/m-p/812261

https://community.powerbi.com/t5/DAX-Commands-and-Tips/SELECTEDVALUE-function-doesn-t-recognized/m-p...

 

You can  take a try to use IF + HASONEVALUE combination  to replace the" selectvalue" function in DirectQuery mode.

IF(HASONEVALUE(Table [column]),VALUES(Table [column]))

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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