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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
KAZ
Regular Visitor

Count of measure in a card

Hi,

 

I am having diffuclty with the count of occupacy.  My table is now showing the correct value after using both measures below. WHen I use the same measure in a card view it has a differnt value which is not correct.  

 

Any help would be much appreciated. 

 

Thank you 😊

 

Measures are as follows:

 

Occupancy5 = VAR EndDatePerVisual = MAX('Dates'[Date]) VAR StartDatePerVisual = Min('Dates'[Date]) VAR RESULT = CALCULATE([Number of rooms checked in], REMOVEFILTERS('DATES'), Reservations[DateArrive] <= EndDatePerVisual, Reservations[DateDepart] > StartDatePerVisual || ISBLANK(Reservations[DateDepart]) ) RETURN RESULT
 
Count of Ocp = SUMX(ADDCOLUMNS(SUMMARIZE('Dates', 'Dates'[Date]), "@Recall", [Occupancy5]), [@Recall])

 

KAZ_0-1677751368837.pngKAZ_1-1677751384765.png

 

KAZ_2-1677751397073.png

 

1 REPLY 1
amitchandak
Super User
Super User

@KAZ , Assume you have active join between Arrival date and date of date table

 

and change the measure like and try

Occupancy5 =
VAR EndDatePerVisual =
    MAX ( 'Dates'[Date] )
VAR StartDatePerVisual =
    MIN ( 'Dates'[Date] )
VAR RESULT =
    calculate(Sumx (filter( Reservations
        Reservations[DateArrive] <= EndDatePerVisual,
        (Reservations[DateDepart] > StartDatePerVisual
            || ISBLANK ( Reservations[DateDepart] ))
    ),
        [Number of rooms checked in]), crossfilter( 'Dates'[Date],Reservations[DateArrive] , none))
        
RETURN
    RESULT

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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