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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
VeemalS
Helper I
Helper I

Sub Total on Column using DatesBetween Function not returning the right total

Hello,

 

I have the following 2 measures:

 

VeemalS_0-1661417651637.png

The first one is Total sales and 2nd one is measure defined as follows:

 

Total Sales First 15 days = Calculate(FactSales[Total Sales],(DATESBETWEEN(Dates[Date],FIRSTDATE(Dates[Date]),FIRSTDATE(Dates[Date]) + 14)) )
 
However, the Total for that column is not right. It is returning the value of first 15 days of the first month of every year.
 
How can we resolve this?
 
Thanks
 
Veemal

 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@VeemalS , The grand does not have date context so it will use the very first date

 

you can use isinscope and change the grand total with a new meausre

 

if(isinscope(Table[Year]),[Total Sales First 15 days] , [sales new measure] )

 

 

IsInScope - Switch measure at different levels: https://youtu.be/kh0gezKICEM

 

you can also try isfiltered

https://powerpivotpro.com/2013/03/hasonevalue-vs-isfiltered-vs-hasonefilter/

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

2 REPLIES 2
v-jianboli-msft
Community Support
Community Support

Hi @VeemalS ,

 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or if you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

 

Refer to:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@VeemalS , The grand does not have date context so it will use the very first date

 

you can use isinscope and change the grand total with a new meausre

 

if(isinscope(Table[Year]),[Total Sales First 15 days] , [sales new measure] )

 

 

IsInScope - Switch measure at different levels: https://youtu.be/kh0gezKICEM

 

you can also try isfiltered

https://powerpivotpro.com/2013/03/hasonevalue-vs-isfiltered-vs-hasonefilter/

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

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.