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

Count of the days in the table

Hello I have a doubt and need help.

 

I have a table for separate the problems for analice, in this table I have 8 colums:

 

DATE DEVICE PARAMETER VALIDATION DAY MOUNTH YEAR COUNT

 

On device column I have the number of equipament for analice, on the parameter column I have a value that indicates the status of device, I need a make a code for that colum validation, I need mark the devices good and bad, butI need to see the validation and count columns, on the column count I try calculate the number of the days that status went good or bad, but I don´t know how making. 

 

Can someone help me please?

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

Hi @diegolima ,

 

If you want to check the device is Good or Bad every month, you can refer the following steps,

 

1. Create two measures to calculate the count of days that the device is good or bad.

 

Bad Count = CALCULATE(DISTINCTCOUNT('Table'[DATE]),FILTER('Table','Table'[PARAMETER]=7))

Good count = CALCULATE(DISTINCTCOUNT('Table'[DATE]),FILTER('Table','Table'[PARAMETER]=3))

 

2. Then we need to create a measure to show the status of each month.

 

Good or Bad = IF([Good count]>[Bad Count],"Good","Bad")

 

The result like this,

 

Count 1.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

BTW, pbix as attached.

 

Best regards,

 

Community Support Team _ zhenbw

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

4 REPLIES 4
v-zhenbw-msft
Community Support
Community Support

Hi @diegolima ,

 

If you want to check the device is Good or Bad every month, you can refer the following steps,

 

1. Create two measures to calculate the count of days that the device is good or bad.

 

Bad Count = CALCULATE(DISTINCTCOUNT('Table'[DATE]),FILTER('Table','Table'[PARAMETER]=7))

Good count = CALCULATE(DISTINCTCOUNT('Table'[DATE]),FILTER('Table','Table'[PARAMETER]=3))

 

2. Then we need to create a measure to show the status of each month.

 

Good or Bad = IF([Good count]>[Bad Count],"Good","Bad")

 

The result like this,

 

Count 1.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

BTW, pbix as attached.

 

Best regards,

 

Community Support Team _ zhenbw

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

diegolima
Helper III
Helper III

This is an example with the false spreadsheet information I have:

 

 

DATE

PARAMETER

DEVICE

VALIDATION

DAY

MOUNTH

YEAR

COUNT

Friday, February 21, 2020

7.00

681512 0

DEVICE  BAD

21

February

2020

366

Thursday, February 20, 2020

7.00

681512 0

DEVICE  BAD

20

February

2020

366

Wednesday, February 19, 2020

7.00

681512 0

DEVICE  BAD

19

February

2020

366

Tuesday, February 18, 2020

7.00

681512 0

DEVICE  BAD

18

February

2020

366

Monday, February 17, 2020

7.00

681512 0

DEVICE  BAD

17

February

2020

366

Saturday, February 22, 2020

3

681512 0

DEVICE  GOOD

22

February

2020

366

Sunday, February 23, 2020

3

681512 0

DEVICE  GOOD

23

February

2020

366

Monday, February 24, 2020

3

681512 0

DEVICE  GOOD

24

February

2020

366

Tuesday, February 25, 2020

3

681512 0

DEVICE  GOOD

25

February

2020

366

Wednesday, February 26, 2020

3

681512 0

DEVICE  GOOD

26

February

2020

366

Thursday, February 27, 2020

3

681512 0

DEVICE  GOOD

27

February

2020

366

Friday, February 28, 2020

3

681512 0

DEVICE  GOOD

28

February

2020

366

Saturday, February 29, 2020

3

681512 0

DEVICE  GOOD

29

February

2020

366

 

In the Validation column to get the result, I need to see the Parameter column (in the example, the value 7.00 is bad and the value 3 is good), but I also need to count the number of days that this value was sent, in the Validation column the final result needs to evaluate the parameter (is it good or bad) and the number of days in the month that this parameter was sent. In this example the validation column is not counting the days, so we have the same device as bad and good in the same month, my goal is to use the number of days to make the device's validation column have only one status or bad or good, in this example the ideal was the device to be as good in the parameters column because during the month of February it sent more parameters good than bad.

 

I think I explained it a little better, see if you can help me, thank you in advance.

v-zhenbw-msft
Community Support
Community Support

Hi @diegolima ,

 

We can create two measures if the validation contain ‘good’ or ‘bad’.

 

Good day = CALCULATE(DISTINCTCOUNT('Table'[DATE]),FILTER('Table','Table'[VALIDATION]="good"))

 

Bad day = CALCULATE(DISTINCTCOUNT('Table'[DATE]),FILTER('Table','Table'[VALIDATION]="bad"))

 

The result like this,

 

Count 1.jpg

 

If it doesn’t meet your requirement, could you please provide a mockup sample based on fake data?

 

It will be helpful if you can show us the exact expected result based on the tables. Please upload your files to OneDrive For Business and share the link here.

 

Please don't contain any Confidential Information or Real data in your reply.

 

BTW, pbix as attached.       

 

Best regards,

 

Community Support Team _ zhenbw

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

parry2k
Super User
Super User

@diegolima it is a bit hard to understand your problem. Read this post to get your answer quickly.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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.

Top Solution Authors