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
dkushner
Frequent Visitor

select value from the table based on current month

Hi,

I've been struggling with writing a DAX statement that will solve this, and would greatly appreciate any help!

I have a table

BudgetPeriodBudgetMonthlyRublesDaysInMonth
01.01.2018397872831
01.02.2018401218828
01.03.2018431982831
01.04.2018451832430
01.05.2018459281231
01.06.2018475251730
01.07.2018561568331
01.08.2018411093731
01.09.2018532610530
01.10.2018545125031
01.11.2018505497430
01.12.2018515188731

 

I need to create a measure that will return the value from the column "BudgetMonthlyRubles" based on the current month and year, so for the january 2018 I should get as a result 3978728

1 ACCEPTED SOLUTION
Drors
Resolver III
Resolver III

Create new measure:

BudgetThisMonth = calculate(sum(BudgetMonthlyRubles),year(table[budgetPeriod])=year(now()),month(table[budgetPeriod])=month(now()))

View solution in original post

3 REPLIES 3
Drors
Resolver III
Resolver III

Create new measure:

BudgetThisMonth = calculate(sum(BudgetMonthlyRubles),year(table[budgetPeriod])=year(now()),month(table[budgetPeriod])=month(now()))

gooranga1
Power Participant
Power Participant

Hi @dkushner

 

You can create a column in your table that extracts the month and year from current date using now() and set the day to 1 then compare that with BudgetPeriod. You will have to format your BudgetPeriod as a type date otherwise you will have to create a string of the date which is possible.

 

Replace "column1" with BudgetPeriod in your case. You can then filter on the table where [Current Date]=1.

 

Current Date = if(DATE(year(now()),month(now()),01)=Table3[Column1],1,0)

 

CurrentMonth.PNG 

Sorry, but I don't understand how it is helping me )
I need to get 1 number to use it later in further calculations

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.