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
LowriDragon
Frequent Visitor

Count invoices in day range

Hey peeps,

 

I am trying to create a measure which will count the number of invoices which have been processed per month.

I then want to be able to filter this with a slicer based on the selected range of days.

My table is called 'Invoices' and the count should be on the column called 'Invoice'.

 

Thanks!

 

LowriDragon_0-1740623621888.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @LowriDragon 

Thanks for the reply from danextian. Perhaps you can try to create multiple Numeric parameters to achieve your needs.

vyaningymsft_0-1740734473603.png

Counts = 
VAR _year = SELECTEDVALUE('Year'[Year])
VAR _month = SELECTEDVALUE('Month'[Month])
VAR _startDay = SELECTEDVALUE('Day Range Start'[Day Range Start])
VAR _endDay = SELECTEDVALUE('Day range end'[Day range end])
VAR _startDate = DATE(_year,_month,_startDay)
VAR _endDate = DATE(_year,_month,_endDay)
VAR _re = CALCULATE(COUNTROWS(Invoices),FILTER(Invoices,Invoices[process ?] = "Yes" && Invoices[date]>=_startDate && Invoices[date]<=_endDate))
RETURN
IF(ISBLANK('Year'[Year Value]) || ISBLANK('Month'[Month Value]) || ISBLANK('Day Range Start'[Day Range Start Value]) || ISBLANK('Day Range Start'[Day Range Start Value]),"Error Date Range",_re
)

 

Best Regards,
Yang

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know.
Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Hi, @LowriDragon 

Thanks for the reply from danextian. Perhaps you can try to create multiple Numeric parameters to achieve your needs.

vyaningymsft_0-1740734473603.png

Counts = 
VAR _year = SELECTEDVALUE('Year'[Year])
VAR _month = SELECTEDVALUE('Month'[Month])
VAR _startDay = SELECTEDVALUE('Day Range Start'[Day Range Start])
VAR _endDay = SELECTEDVALUE('Day range end'[Day range end])
VAR _startDate = DATE(_year,_month,_startDay)
VAR _endDate = DATE(_year,_month,_endDay)
VAR _re = CALCULATE(COUNTROWS(Invoices),FILTER(Invoices,Invoices[process ?] = "Yes" && Invoices[date]>=_startDate && Invoices[date]<=_endDate))
RETURN
IF(ISBLANK('Year'[Year Value]) || ISBLANK('Month'[Month Value]) || ISBLANK('Day Range Start'[Day Range Start Value]) || ISBLANK('Day Range Start'[Day Range Start Value]),"Error Date Range",_re
)

 

Best Regards,
Yang

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know.
Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

danextian
Super User
Super User

Hi @LowriDragon 

 

What is the logic to count the invoices by day when your data shows by month?





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

I want to be able to count the number of invoices processed per month, within the first 10 days, or the first 15 days. This is for comparison purposes. 

 

This is just a sample measures based on the data provided:

15 days =
CALCULATE (
    [invoice count],
    FILTER ( VALUES ( dates[date] ), DAY ( dates[date] ) <= 15 )
)

 

If this isn't what you're looking for, please provide a workable sample data (not an image), your expected result from the same sample data and your reasoning behind. https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447... 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

I am looking for this to be dynamic with a slicer for selecting the day range. The day range is based on the day numbers in the date table.

 

Going back to this:

Please provide a workable sample data (not an image), your expected result from the same sample data and your reasoning behind.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

I have explained my reasoning, not that I should need to justify what I am trying to do.

If you can't help, that's ok. 

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.