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

Summarizing COVID cases by day one day two and so on for each countries

Hi , 
I want the cases count to be displayed for day one and day two for each country 

for eg. country A day one is 01/01/2021 ,whereas for country B its 01/04/2021. 

refer to I/p and desired O/P below

 

    
I/P   
    
DateCountryCount 
01/01/2021A1000 
01/02/2021A290 
01/03/2021A200 
01/04/2021A500 
01/02/2021B50 
01/03/2021B0 
01/04/2021B250 
01/04/2021C105 
    
    
    
O/P   
 ABC
Day 1100050105
Day 229000
Day 32002500
Day 450000
  

 

 

 

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

You can try the following methods.

Column:

Days = 
CALCULATE (
    COUNT ( 'Table'[Date] ),
    FILTER (
        'Table',
        [Country] = EARLIER ( 'Table'[Country] )
            && [Date] <= EARLIER ( 'Table'[Date] )
    )
)

vzhangti_0-1651217136162.png

Then add the matrix view to get the results you expect.

vzhangti_1-1651217173349.png

 

Best Regards,

Community Support Team _Charlotte

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

5 REPLIES 5
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

You can try the following methods.

Column:

Days = 
CALCULATE (
    COUNT ( 'Table'[Date] ),
    FILTER (
        'Table',
        [Country] = EARLIER ( 'Table'[Country] )
            && [Date] <= EARLIER ( 'Table'[Date] )
    )
)

vzhangti_0-1651217136162.png

Then add the matrix view to get the results you expect.

vzhangti_1-1651217173349.png

 

Best Regards,

Community Support Team _Charlotte

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

Anonymous
Not applicable

Hi @v-zhangti 

 

Thanks for soln. It works. But I need a measure. I am not allowed to add a calculated column. Is there a way to achieve this thru measure? Thanks in advance

Hi, @Anonymous 

 

Measure:

Days 2 = 
CALCULATE (
    COUNT ( 'Table'[Date] ),
    FILTER (
        ALL('Table'),
        [Country] = SELECTEDVALUE( 'Table'[Country] )
            && [Date] <= SELECTEDVALUE( ( 'Table'[Date] )
    )
))

This is the same as the result of calculating the column. But measure cannot be put inside Rows in matrix view.

vzhangti_0-1652433369996.png

 

Best Regards

amitchandak
Super User
Super User

@Anonymous , You have to create a new column and use that in visual

 

Day = datediff(Min(Table[Date]), Table[Date], day) +1

Anonymous
Not applicable

Hi , This doesnot rank days for each country.

I have added what should the day no look like in annotation

 

SrikumarS_0-1651470198741.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.