Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Calculated column filtered by two columns value

Hi,

I have this calculated table, it has rows with values, colums with date of creation truncated to weeks and a check in value.

I need another colum with the value of the last week (creation week - 7 days) and check in date last year.

I´ve tryed several solution with out acurrate result, what will be the best aproach?

Thanks!

 
 

2020-03-19 12_01_59-Window.png

1 ACCEPTED SOLUTION

Try :

New Column = sumx(filter(Table,[Creation] = (earlier([creation]) - 7) && [Check in] = (earlier([check in]) - 365)),[room nights])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

Did not get it completely

New column = [creation date]-7

 

The other I did not get

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi

Thanks frist of all!

New Colum = sum(room nights) where Creation = creation - 7 and Check in = check in - 365

In SQL it´s easy 🙂

Cheers

 

Try :

New Column = sumx(filter(Table,[Creation] = (earlier([creation]) - 7) && [Check in] = (earlier([check in]) - 365)),[room nights])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Greg_Deckler
Community Champion
Community Champion

Not 100% on what you are asking with that last one. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

If you want the value of the last week you can do this:

 

Column =
  VAR __Current = [CheckIn]
  VAR __CurrentMinus7Days = (__CurrentWeek - 7) * 1.
RETURN
  MAXX(FILTER('Table',[Checkin] = __CurrentMinus7Days),[RoomNights])
  


Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thanks for your help, but this does not work.

I just wanted to put the same value of last year creation and last year check in, trys to use your solution with out luck:

LastYearCreationsOverlastYearCheckin =
VAR __Creation = [Creation]
VAR __CreationMinus365Days = ( __Creation - 365) * 1
VAR __CheckIn = RoomNights[CheckIn]
VAR __CheckInMinus365Days = ( __CheckIn - 365) * 1
RETURN
MAXX(FILTER(RoomNights;(RoomNights[Creation] = __CreationMinus365Days && RoomNights[CheckIn] = __CheckInMinus365Days));[RoomNights])
I want the same value of creation - 365 day and the same value of checkin - 365 day
Validating this data against SQL does not work.
Can you please help me and thanks!!!!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.