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
Mmahachi
Advocate I
Advocate I

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
Anonymous
Not applicable

-- 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
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.

Top Solution Authors