cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mmahachi Regular Visitor
Regular Visitor

selected value is not taking alternate

hoping this is pretty simple... I have a dax measure that is supposed to supply the last fiscal period if nothing is selected, the problem is it just shows blank unless the fiscal period is in the visual either as an axis or a filter. I just want the card to show total revenue.

 

Total_Revenue = var FYPeriod = SELECTEDVALUE('Acct Period'[FiscalYearPeriod], LASTNONBLANK('Acct Period'[FiscalYearPeriod], SUM('Proj Detail'[YTDIncurredAmount])))
Return
CALCULATE(SUM('Proj Detail'[YTDIncurredAmount]), 'Proj Detail'[RateType] <> "Actuals", 'CNPAccount'[SummaryCategory] = "Revenue" || 'CNPAccount'[SummaryCategory] ="Revenue Adjustment",'Acct Period'[FiscalYearPeriod] = FYPeriod)

1 REPLY 1
Highlighted
Super User
Super User

Re: selected value is not taking alternate

-- You should create a measure first (name it something sensible, not Measure):

[Measure] = SUM ( 'Proj Detail'[YTDIncurredAmount] ) 

-- Then try this (measures and columns exposed in reports should not have underscores in their names):

[Total Revenue] =
VAR FYPeriod =
if(
    HASONEVALUE( 'Acct Period'[FiscalYearPeriod] ),
    VALUES ( 'Acct Period'[FiscalYearPeriod] ),
    LASTNONBLANK (
    	'Acct Period'[FiscalYearPeriod],
        [Measure]
   )
)
RETURN
    CALCULATE (
        [Measure],
        'Proj Detail'[RateType] <> "Actuals",
        TREATAS(
        	{ "Revenue", "Revenue Adjustment" },
        	'CNPAccount'[SummaryCategory]
        ),
        'Acct Period'[FiscalYearPeriod] = FYPeriod
    )

The above might or might not work. This depends on the logic you want but since I can't know what you want, I'm giving you what I guess could work in your case. Bear in mind that boolean filters in CALCULATE overwrite filters coming from outside.

 

Best

Darek

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 307 members 2,508 guests
Please welcome our newest community members: