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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
CastroRibeiro
Helper I
Helper I

Count if current date is between a data range

 

I have the columns: [MARCO INICIAL] and [MARCO_FINAL]

I need to know if the current date is among these data and then sum 

Example: Today is 11, if this value is between this data.

I tried to do something like this:

But this way it will only sum if the column [MARCO_INICIAL] OR [MARCO_FINAL] was equal to the current date

 

FRANQUIA_TOTAL = 
var totalIndisponibilidade = CALCULATE(
    COUNTROWS(
        FILTER(
            TBL_DISPONIBILIDADE_FROTA_AEREA,
            DAY(TBL_DISPONIBILIDADE_FROTA_AEREA[MARCO_INICIAL]) >= DAY(NOW()) &&
            DAY(TBL_DISPONIBILIDADE_FROTA_AEREA[MARCO_FINAL]) <= DAY(NOW()) &&
            TBL_DISPONIBILIDADE_FROTA_AEREA[TIPO_OCORRENCIA] = "UTILIZAÇÃO DE FRANQUIA"
        )
    )
)
var _total = FORMAT(totalIndisponibilidade,UNICHAR(9650)&" 0") 


return _total 

 

1 REPLY 1
Ashish_Mathur
Super User
Super User

Hi,

This should ideally solved with a calculated formula (not a measure).  If you are OK with my approach, then share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.