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
yiying
Helper I
Helper I

Create Measure that shows monthly total under each day

Capture.PNGHere is what my data look like now. I have been trying to create a new measure that for each day in December, it will show the same number 122251, which is the total. The number changes by month of course. Thanks!

5 REPLIES 5
Zubair_Muhammad
Community Champion
Community Champion

Hi @yiying

 

Try this MEASURE

 

Measure =
CALCULATE (
    [CountMeasure],
    FILTER (
        ALL ( TableName ),
        MONTH ( TableName[Dates] ) = MONTH ( SELECTEDVALUE ( TableName[Dates] ) )
            && YEAR ( TableName[Dates] ) = YEAR ( SELECTEDVALUE ( TableName[Dates] ) )
    )
)

Regards
Zubair

Please try my custom visuals

Thank you so much it works!!

 

Another question. I also have a attribute "Type". When I add the filter , the new measure I created does not change. What should I do? 

HI @yiying

 

Try Replacing ALL with ALLEXCEPT....

 

Check this revised code

 

Measure =
CALCULATE (
    [CountMeasure],
    FILTER (
        ALLEXCEPT ( TableName, TableName[Attribute] ),
        MONTH ( TableName[Dates] ) = MONTH ( SELECTEDVALUE ( TableName[Dates] ) )
            && YEAR ( TableName[Dates] ) = YEAR ( SELECTEDVALUE ( TableName[Dates] ) )
    )
)

Regards
Zubair

Please try my custom visuals

@yiying

 

Alternatively this should work as well

 

Just replace ALL(TableName) with All(TableName[Dates])

 

Measure =
CALCULATE (
    [CountMeasure],
    FILTER (
        ALL ( TableName[Dates] ),
        MONTH ( TableName[Dates] ) = MONTH ( SELECTEDVALUE ( TableName[Dates] ) )
            && YEAR ( TableName[Dates] ) = YEAR ( SELECTEDVALUE ( TableName[Dates] ) )
    )
)

Regards
Zubair

Please try my custom visuals

Thank you! The allexcept works. But the on with all does not work for some reason. 

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.