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
ttseng
Helper III
Helper III

Calculate weekly reports based on daily submissions

Hi,

 

I have a data set that provides daily reports from various facility. What i'm trying to get is to find out the number of sites that provided 5 reports that week. What i'm looking for is a bar graph with weeks as the X and the Y as the number of sites that provided 5 reports that week. This is what my data looks like:

 

ReportFacilityWeek
dailySite A1
dailySite A1
dailySite A1
dailySite A1
dailySite A1
dailySite B1
dailySite B1
dailySite B1
dailySite B1
dailySite B1
dailySite C1
dailySite C1
dailySite C1
dailySite C1
dailySite A2
dailySite A2
dailySite A2
dailySite B2
dailySite B2
dailySite B2

 

I'm struggling to figure how how to do this with measures. 

 

Thank you!

1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi @ttseng ,

What you need is to create a measure as below:

total sites =
VAR _table =
    SUMMARIZE (
        'Table',
        'Table'[Facility],
        'Table'[Week],
        "Report1", COUNT ( 'Table'[Report] )
    )
VAR number =
    SUMX ( _table, [Report1] )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[Facility] ),
        FILTER ( _table, [Measure 2] = 5 )
    )

Finally you will see: 

 

1111.png

For the related .pbix file,pls click here.

 

Best Regards,

Kelly

 

 

 

View solution in original post

5 REPLIES 5
v-kelly-msft
Community Support
Community Support

Hi @ttseng ,

What you need is to create a measure as below:

total sites =
VAR _table =
    SUMMARIZE (
        'Table',
        'Table'[Facility],
        'Table'[Week],
        "Report1", COUNT ( 'Table'[Report] )
    )
VAR number =
    SUMX ( _table, [Report1] )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[Facility] ),
        FILTER ( _table, [Measure 2] = 5 )
    )

Finally you will see: 

 

1111.png

For the related .pbix file,pls click here.

 

Best Regards,

Kelly

 

 

 

Thank you @v-kelly-msft - this solution worked for me!

Hi @v-kelly-msft ,

 

I want to thank you for providing the original solution. I've returned with another question. It's always the seemingly simple questiosn that baffle me.

 

This time I want to be able to return sites that did not submit data. So in your example it would be Measure 2 = 0. However, I have a suspicion that it's not possible. How would one go about solving such a problem? Create a master table to reference if Week and Facility is missing return 0? or something like that. 

 

In the end i want to be able to return facility, week number, and if data was submitted or not. 

 

Thank you again!

 

-Tony

HotChilli
Super User
Super User

You could put 'Week' on the axis, Count of Report in the Value well and Facility in the legend.

That will give you a clustered column chart with all data.

You could use the Visual filters to set a value on the Count of Report field (either = 5 or any other filter)

image.png

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.