Code is:
Revenue YTD:=CALCULATE ( [Revenue] , DATESYTD('Date'[Date],"31/05") )
Revenue LYTD:=CALCULATE ( [Revenue YTD] , SAMEPERIODLASTYEAR('Date'[Date]) )
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.
I have a Fact Revenue, with 2 dimensions: Customer and Category.
I have the below data:
Customer | Category | Revenue YTD | Revenue LYTD |
x | OldCategory | (blank) | 150 |
x | NewCategory | 2000 | (blank) |
(In my pbix I have the below visual). There are just 1 or 2 customers that have changed category; so for that specific case, I see:
Category | Revenue YTD | Revenue LYTD |
NewCategory | 2000 | (blank) |
(This is correct, since the NewCategory has no revenue for the last year).
But, I don't want to see Revenue LYTD as blank; is there a way to display Category, but in fact do a group by Customer?... That way, I would be able to display:
Category | Revenue YTD | Revenue LYTD |
NewCategory | 2000 | 150 |
Code is:
Revenue YTD:=CALCULATE ( [Revenue] , DATESYTD('Date'[Date],"31/05") )
Revenue LYTD:=CALCULATE ( [Revenue YTD] , SAMEPERIODLASTYEAR('Date'[Date]) )
Hi, @ovonel
Try the following formula:
Revenue LYTD =
VAR _lytd =
CALCULATE ( [Revenue YTD], SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
RETURN
IF ( ISBLANK ( _lytd ), [Revenue YTD], _LYTD )
If it doesn't meet your requirement, please share more details.
Best Regards,
Community Support Team _ Eason
@ovonel , not very clear what output you want you can try values
CALCULATE ( [Revenue] , DATESYTD('Date'[Date],"31/05"), values (Table[Customer] ))
Revenue LYTD:=CALCULATE ( [Revenue YTD] , SAMEPERIODLASTYEAR('Date'[Date]), values (Table[Customer] ) )
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
97 | |
80 | |
69 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |