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
Anonymous
Not applicable

Issue using isonorafter () and a Date Var

Hello guys!.

Im trying to plot an accumulative sum based on the last date entered in a DateField Box. My plot has to show all the months of the current selected year (for example: if i pick 01-jun-20 on the second DateFieldBox ... the plot has to go from 01-jan-20 to 31-dec-20). 

I tried this code but it doesnt work as i expect.
01andres =

VAR month =
MONTH ( MAX ( 'Calendario'[Fecha] ) )
VAR year =
YEAR ( MAX ( 'Calendario'[Fecha] ) )
VAR last1 =
DATE ( year, 12, 31 )
VAR first1 =
DATE ( year, 1, 1 )
RETURN
CALCULATE(
    COUNTA('Tareas'[Tare_Fech_Prog]),
    FILTER(
        ALLSELECTED('Calendario'[Fecha]),
        ISONORAFTER('Calendario'[Fecha],last1, DESC,'Calendario'[Fecha],first1, ASC)
    )
)



Captura.JPG

 

When i use Max(), it works but it shows the values between the DateFilde box range entered and i dont want it.

Captura.JPG

 

What should i do?.

Thank youu!!

8 REPLIES 8
v-cazheng-msft
Community Support
Community Support

Hi, @Anonymous 

 

This is a video about the usage of the ISONORAFTER function. For your first formula, the usage of this function maybe a little bit wrong and only the first half of the parameters work. In addition, is there only data from 16-April-2020 to 31-December-2021 in your table?

 

Best Regards,

Caiyun Zheng

Anonymous
Not applicable

Hi @v-cazheng-msft ,

No, I have data from 2019 to 2024

Hi, @Anonymous 

Is DateFieldBox in your report a Slicer? Can you provide a sample removing sensitive data and describe your report with more details?

 

Best Regards

Caiyun Zheng

Anonymous
Not applicable

Hi @v-cazheng-msft , thanks for your help.

pbi file:
https://drive.google.com/file/d/1Y47QDmcawQ7x2BQOsarrAurGbsSs7IPJ/view?usp=sharing

i want to do an accumulative sum with "programed" and "executed" dates (watch "tareas" table).
The year of my second input in DateFieldBox decides the plot range. If I select 13-06-2020 and 18-09-2020, i have to do an acumulative sum from 01-01-2020 to 31-12-2020.

Isonorafter isnt working with Var = Date() ... only works with max(date).


Hi, @Anonymous 

Do the values in this figure you want? Can you describe the calculated logic of it?

v-cazheng-msft_0-1612953303518.png

Ive got a visual like the following figure, but the values in it different from the figure you provided. 

v-cazheng-msft_1-1612953303526.png

 

 

Best Regards,

Caiyun Zheng

Anonymous
Not applicable

Hello @v-cazheng-msft ,

My 2020 plot is ok except in the part it shows from april.

The logic is that january is only january ... february is equal to january + february .... so december = december + november + october + ...... january.

I think your figure is showing regardless of the year entered

amitchandak
Super User
Super User

@Anonymous , Try a measure like

 

Cumm =
var _max = maxx(allselected('Date'), 'Date'[Date])
return
CALCULATE(COUNTA('Tareas'[Tare_Fech_Prog]),filter(all('Date'),'Date'[Date] <=max('Date'[Date]) && year('Date'[Date]) = _max))

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
Anonymous
Not applicable

Hi @amitchandak , thank you for your reply!

I did it but it shows nothing. 


Captura.JPGCaptura.JPG

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

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.