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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
RavChop
Regular Visitor

Return columns when the to and from dates fall between the current date

Hi, I'm quite the PowerBI amateur but I was trying to create a measure that does the following. 

 

I want to display the current weeks reporting week when the effective from date is greater than or equal to todays date, and the effective to date is less than or equal to todays date. 

 

I have created the following measure 

 

 

Current Reporting Week = 
IF (
    VALUES ( recco_mscreportingweek[recco_effectivefrom] ) >= TODAY ()
        && VALUES ( recco_mscreportingweek[recco_effectiveto] ) <= TODAY (),
    true,
    false
)

 

 

But what I want to do is return the reporting week column if the statement above is true. 

 

A measure may not be the way to go, so any help at all will be appreciated. 

Thank you. 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@RavChop , you can have a column like

 

Current Reporting Week =
IF (
( recco_mscreportingweek[recco_effectivefrom] ) >= TODAY ()
&& ( recco_mscreportingweek[recco_effectiveto] ) <= TODAY (),
recco_mscreportingweek[reporting week],
blank()
)

 

or create a measure

 

Current Reporting Week =
countrows(Filter(recco_mscreportingweek, IF (
VALUES ( recco_mscreportingweek[recco_effectivefrom] ) >= TODAY ()
&& VALUES ( recco_mscreportingweek[recco_effectiveto] ) <= TODAY (),
true(),
false()
)))

 

use with reporting week

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@RavChop , you can have a column like

 

Current Reporting Week =
IF (
( recco_mscreportingweek[recco_effectivefrom] ) >= TODAY ()
&& ( recco_mscreportingweek[recco_effectiveto] ) <= TODAY (),
recco_mscreportingweek[reporting week],
blank()
)

 

or create a measure

 

Current Reporting Week =
countrows(Filter(recco_mscreportingweek, IF (
VALUES ( recco_mscreportingweek[recco_effectivefrom] ) >= TODAY ()
&& VALUES ( recco_mscreportingweek[recco_effectiveto] ) <= TODAY (),
true(),
false()
)))

 

use with reporting week

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

I tried creating a column, however, when I try to use that column in a visual there seems to be no data. I have checked to ensure I have date that falls between the date range of effective from and effective to, but the visual is still blank. 

Apologies, I realise my condition was wrong and needed to swap around the >=, this has worked really well, thank you! 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.