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
sinanalmac
Resolver I
Resolver I

show previous month that moth name is text . Is there a bug in PBI

Hi all ,
I have table. I just want to  do  no matter which month I choose, It  shows the calculated data of the previous month, I created  month table  and did this  measure

TotalValuePreForeUSA = 

var select=SELECETEDVALUES(FilterTable[MonthEn])
var test=SWITCH(Select,"Sep","Aug","Oct","Sep","Nov","Oct")
var test2= LOOKUPVALUE(FcTable[PreFcMonth], FcTable[MonthEn],VALUES(FilterTable[MonthEn]))
return

IF(VALUES(PYPF[Comp])="PY", 
CALCULATE(sum(Finance[Value]),SAMEPERIODLASTYEAR(DimDate[Date]),Finance[Country]="USA"),
CALCULATE(SUM(Finance[Value]),Finance[ForecastMonth]=select,Finance[Country]="USA")

 

IF  calculate(first one)  was worked. but else  calculate ( the second)  was not worked.

 

finance table

Date	year	Moth	Value	Country
2019-01-01	2019	JAN 	10	USA
2019-02-01	2019	FEB	20	USA
2019-03-01	2019	MAR	30	USA
2019-04-01	2019	APR	40	USA
2019-05-01	2019	MAY	50	USA
2019-06-01	2019	JUN	2132	USA
2019-07-01	2019	JUL	42	USA
2019-08-01	2019	AUG	952	USA
2019-09-01	2019	SEP	1107	USA
2019-10-01	2019	OCT	1262	USA
2019-11-01	2019	NOV	1417	USA
2019-12-01	2019	DEC	1572	USA
2018-01-01	2018	JAN 	10	USA
2018-02-01	2018	FEB	20	USA
2018-03-01	2018	MAR	30	USA
2018-04-01	2018	APR	40	USA
2018-05-01	2018	MAY	50	USA
2018-06-01	2018	JUN	2132	USA
2018-07-01	2018	JUL	42	USA
2018-08-01	2018	AUG	952	USA
2018-09-01	2018	SEP	1107	USA
2018-10-01	2018	OCT	1262	USA
2018-11-01	2018	NOV	1417	USA
2018-12-01	2018	DEC	1572	USA

Filter table

MonthPrev	MonthEn
JAN	FEB
FEB	MAR
MAR	APR
APR	MAY
MAY	JUN
JUN	JUL
JUL	AUG
AUG	SEP
SEP	OCT
OCT	NOV
NOV	DEC
DEC	JAN

I must be work  but it didn't

is there any suggestion??

 

Best Regards
Sinan  

1 ACCEPTED SOLUTION

Hi @Mariusz  

Thank you for your attention. I solved the problem. I gave a number to each month's name and recalculated the Dax formula over this column. It showed the result that ı wanted to
Thanks Again
Best regards
Sinan 

View solution in original post

5 REPLIES 5
Mariusz
Community Champion
Community Champion

Hi @sinanalmac 

 

Try this 

Sum of Values Last Month = 
CALCULATE(
    [Sum of Values],
    DATEADD( 'Table'[Date], -1, MONTH ), 
    ALL( 'Table' )
)

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

 

Thankyou 
But My month name is  text  formmated.I just wanta Seleced the value Monthname(Text)= Monthname(Text)

CALCULATE(SUM(Finance[Value]),Finance[ForecastMonth]=select,Finance[Country]="USA")


Best regads
Sinan

 

 

Hi @sinanalmac 

 

This Measure will return Previous Month isn't that what you were after?

 

 Many thanks

Mariusz

Hi @Mariusz  

Thank you for your attention. I solved the problem. I gave a number to each month's name and recalculated the Dax formula over this column. It showed the result that ı wanted to
Thanks Again
Best regards
Sinan 

Greg_Deckler
Super User
Super User

You are going to need an ALL in there somewhere in order to kick out of the current context and include all rows. Then you can filter down to the correct month and year that you want to display.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.