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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
tqn626
Frequent Visitor

Average of Distinctcount over time

I have this code that shows me the disctinctcount of stores with any sales. I'm using this in a calendar visual. How would I get the average distinct count at each calendar category. In the visual on the bottom i want the monthly to show 19 stores instead of 39.

 

 

Stores =
CALCULATE (
    DISTINCTCOUNT ( DimStore_List[Store] ),
    FILTER ( 'Daily Data', 'Daily Data'[Net_Sales] > 0 )
)

 

 

Stores.PNG

1 ACCEPTED SOLUTION

Hi @tqn626 ,

 

You can try the following measure:

 

Stores =
IF (
    ISINSCOPE ( the_hierarchy_in_fw_quarater ),
    CALCULATE (
        DISTINCTCOUNT ( DimStore_List[Store] ),
        FILTER ( 'Daily Data', 'Daily Data'[Net_Sales] > 0 )
    ),
    AVERAGEX (
        DimStore_List,
        CALCULATE (
            DISTINCTCOUNT ( DimStore_List[Store] ),
            FILTER ( 'Daily Data', 'Daily Data'[Net_Sales] > 0 )
        )
    )
)

 

If you need accurate formula, please show us sample data.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@tqn626 , Based on the group level of Day or month then create a measure like

 

Stores =
var _1 =
CALCULATE (
DISTINCTCOUNT ( DimStore_List[Store] ),
FILTER ( 'Daily Data', 'Daily Data'[Net_Sales] > 0 )
)
return
sumx(values(Date[Date]),_1)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hmm, This didn't work, I got a much larger number.

Hi @tqn626 ,

 

You can try the following measure:

 

Stores =
IF (
    ISINSCOPE ( the_hierarchy_in_fw_quarater ),
    CALCULATE (
        DISTINCTCOUNT ( DimStore_List[Store] ),
        FILTER ( 'Daily Data', 'Daily Data'[Net_Sales] > 0 )
    ),
    AVERAGEX (
        DimStore_List,
        CALCULATE (
            DISTINCTCOUNT ( DimStore_List[Store] ),
            FILTER ( 'Daily Data', 'Daily Data'[Net_Sales] > 0 )
        )
    )
)

 

If you need accurate formula, please show us sample data.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Solution Authors
Top Kudoed Authors