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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
vvv
New Member

PowerBI Table and Chart

Hi, Below is my sample data and result needed, i am trying in calculated column but its giving count for each month , but not like i am expecting the result set.

 

Please help me with the DAX or Calculated column

I have Data Like This   
IDStartDateEndDate 
15/1/20225/31/2022 
16/1/20226/30/2022 
110/1/202210/30/2022 
111/1/202211/30/2022 
111/1/202211/30/2022 
112/1/202212/31/2022 
112/1/202212/31/2022 
11/1/20231/31/2023 
    
    
Result neededMonth YearCount 
 OCT 202235/1/2022 to 10/30/2022
 NOV-202255/1/2022 to 11/30/2022
 DEC-202275/1/2022 to 12/31/2022
 JAN-202385/1/2022 to 1/31/2023
4 REPLIES 4
tamerj1
Super User
Super User

Hi @vvv 

you have to have a Date table minimum with Date and Year Month columns. The you can use

Count =
SUMX (
VALUES ( 'Date'[Year Month] ),
CALCULATE (
VAR MaxDate =
MAX ( 'Date'[Date] )
VAR MinDate =
MIN ( 'Date'[Date] )
RETURN
COUNTROWS (
FILTER ( 'Table', 'Table'[StartDate] <= MaxDate && 'Table'[EndDate] >= MinDate )
)
)
)

JW_van_Holst
Resolver IV
Resolver IV

This are the two tables I use:
Picture1.png

and this is the DAX code

_result = 
VAR EOM = MAX(MonthYear[End of Month])
VAR _filter = FILTER(Transactions, Transactions[EndDate] <= EOM)
RETURN
COUNTROWS(_filter)

and this is the result:
Picture1.png

Greg_Deckler
Community Champion
Community Champion

@vvv Better Running Total - Microsoft Power BI Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi,

I did this but , i am getting same count count for all Months
Oct 22 - 8

Nov -22 8
Dec  22 8

 

Am i missing anything

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.