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
kruthikav
Frequent Visitor

Need advice on solving below problem

DateIDPeriod
26/06/202239750202206
26/06/202239951202206
01/05/202218679202205
22/04/202230091202204
21/04/202228233202204
20/04/202214501202204
16/04/202214501202204
14/04/202226936202204
04/05/202213284202205
25/05/202214501202205
21/05/202213241202205

Period is the filter used in the visualization.

if year & month(Period) is latest--> count with latest date and the dates 29 days before,
count(distinct id)
if year&month(period) is not the latest--> count with last date that month and the dates 29 days before,
count(distinct id)

 

 

 

 

 

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

Hi @kruthikav ,

You can create a measure as below to get it, please find the details in the attachment.

Count = 
VAR _selpreiod =
    SELECTEDVALUE ( 'Table'[Period] )
VAR _firstdate =
    DATE ( VALUE ( LEFT ( _selpreiod, 4 ) ), VALUE ( RIGHT ( _selpreiod, 2 ) ), 1 )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[ID] ),
        FILTER (
            'Table',
            'Table'[Date]
                >= EOMONTH ( _firstdate, 0 ) - 29
                && 'Table'[Date] <= EOMONTH ( _firstdate, 0 )
        )
    )

yingyinr_0-1656061440248.png

If the above one can't help you get the desired result, please provide more sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Community Support Team _ Rena
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-yiruan-msft
Community Support
Community Support

Hi @kruthikav ,

You can create a measure as below to get it, please find the details in the attachment.

Count = 
VAR _selpreiod =
    SELECTEDVALUE ( 'Table'[Period] )
VAR _firstdate =
    DATE ( VALUE ( LEFT ( _selpreiod, 4 ) ), VALUE ( RIGHT ( _selpreiod, 2 ) ), 1 )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[ID] ),
        FILTER (
            'Table',
            'Table'[Date]
                >= EOMONTH ( _firstdate, 0 ) - 29
                && 'Table'[Date] <= EOMONTH ( _firstdate, 0 )
        )
    )

yingyinr_0-1656061440248.png

If the above one can't help you get the desired result, please provide more sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
speedramps
Super User
Super User

We wnat to help but sorry, i am a volunteer helping on a Sunday (my day off)

If you cant take the effort to carefully provide the info requested then there are plenty of other people on this forum who need help who will. 😁😁

 

Please provide examples of your input data as a tables not screen shorts (so we can import them and build a solution).

Also provide an example of the desired output with clear description. Dont share private data.

Thank you 

I have added the table. Please let me know if it helps

speedramps
Super User
Super User

We want to help but it looks like you have rushed this and it does not make sense 🙁🙁.

 

To get a quick answer, please take more care.

 

Provide examples of your input data as a tables not screen shorts (so we can import them and build a solution).

 

Also provide an example of the desired output with clear description. Dont share private data.

 

Try use consistent field names in the input date, the output data and the decsription ... so we know what you mean.

 

Thank you  😁😁

 

 

 

To the above dataset.. We have provided period filter.. So based on the filter selection we need the count of ID..

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.