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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Count active ids by day, month quarter Year

Hi I am attaching my sample file in this file Please see Page 1, i have calculated column named "Count of Reservation" and one measure named "Count". THe bar chart on page 1 is giving me correct result on all time periods but no slicers are working with this. Please help me resolve this issue. 

Link of pbix

 

Calculated Column: Count of reservations = CALCULATE(COUNT(Reservation[ID]),FILTER(Reservation,Reservation[Fromdate]<=Dates[Date]),FILTER(Reservation,Reservation[Todate]>=Dates[Date]))
 
Measure Count = Calculate(Sum(Dates[Count of reservations] )/365)
 
Date table = 
Dates = CALENDAR(MIN(Reservation[Fromdate]),MAX(Reservation[Todate]))
Reservation Table 
ID                Fromdate            Todate              Type
17/1/201712/31/20171
27/1/20186/30/20193
37/1/20179/30/20171
410/1/201712/31/20171
51/1/20183/31/20182
64/1/20186/30/20182
77/1/20189/30/20182
810/1/201812/31/20182
91/1/20193/31/20193
108/1/20179/30/20171
1 ACCEPTED SOLUTION
v-cherch-msft
Employee
Employee

Hi @Anonymous

 

You may create two measures as below:

Measure =
COUNTX (
    FILTER (
        GENERATE ( Dates, Reservation ),
        Dates[Date] >= Reservation[Fromdate]
            && Dates[Date] <= Reservation[Todate]
    ),
    Reservation[ID]
)
Measure 2 = [Measure]/365

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
v-cherch-msft
Employee
Employee

Hi @Anonymous

 

You may create two measures as below:

Measure =
COUNTX (
    FILTER (
        GENERATE ( Dates, Reservation ),
        Dates[Date] >= Reservation[Fromdate]
            && Dates[Date] <= Reservation[Todate]
    ),
    Reservation[ID]
)
Measure 2 = [Measure]/365

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thanks alot for your help

Greg_Deckler
Super User
Super User

Not seeing the PBIX. Perhaps has something to do with your relationships between tables but tough to say.


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable
Anonymous
Not applicable

Please see Page 1 in the file and Count of Reservation calculated column and Count Measure.

Anonymous
Not applicable

Thanks for your reply. Sorry for the file I will upload and give link
Anonymous
Not applicable

There is no relationship between columns because I have 2 date columns in reservation table

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.