Count Employers with >= than 4 events in 12 month rolling

Good afternoon ,

I would kindly request help in Dax query because mine one doesn’t capture all possibilities.

20_08- sample data.xlsx (11.3 MB)

Based on this data , I have to create measure which counts number of employers with more or equal ( >=)than 4 events in last 12 months rolling.

This one is incorrect : more than 4 events =
COUNTROWS (
FILTER (
VALUES ( ‘20220807 Events’[Employee]) ,
CALCULATE (
DISTINCTCOUNT( ( ‘20220807 Events’[Events_ID] )) >= 4

)))

Would you please help to accomplish this task.

Many thanks, Iwona
4 or more events.pbix (71.7 KB)

@Iwona

Possible to share PBI file?

Hi @DashboardingMeesters
Of course, I have added to my post.

Iwona

@Iwona

Maybe I don’t understand you correctly, but you have 1876 Employees and also 1876 rows. How could 1 employee have more than 1 event?

Hi,

Please notice, that Employee ID’S are not unique values. Unique value are Event ID column only. Most of employees are assigned to more than one event and I need count them with 4 or more events.

Thanks,

Iwona

@Iwona
image
image

I guess they are according to the file?

@DashboardingMeesters ,

Apologies for my mistake,

Let me upload new correct file. I shouldn’t export it from PBI table and masked it.

Iwona

@Iwona

Is it corrected in your orignal post?

@DashboardingMeesters

I have uploaded new PBI file and Excel raw data sample as well.
Big thank you for your help and support,

Iwona

@DashboardingMeesters

I have uploaded new PBI file and Excel raw data sample as well.
Big thank you for your help and support,

Iwona

@Iwona

See possible solution in the attached file. Could you verify yourself whether this is correct or not?

4 or more events Solution DM.pbix (184.5 KB)

If not, please let me know and I will figure it out.

If something is unclear, let me know as well. Happy to assist further

Kind regards,
Pim Meesters

Hi Pim,

So grateful for your help,

Would it be possible to get this view :

Many thanks, Iwona

1 Like

@Iwona

Replace the C\ untill the last \ with your file path and it will work.

It’s just the path of where i saved the 20-08 sample data file you provided in the original post.

Can you figure this out or need more help?

I am afraid , there is something wrong.

I got a few times more figures than other team achieved :frowning_face:

Iwona

@Iwona

I remeber using >4 instead of >= 4. so replace that and maybe that solves the issue.

If not, please provide more context than ‘something is wrong’ :sweat_smile: And I will look futher into it

Look at this :frowning_face:

@Iwona

EDIT: It’s because you have the > = 4 = in your measure. Therefore PBI will check wehter 4 is equal to the value returned by the countrows. If you want to rename the measure correctly, use: ≥ (see attached file as well. this should work.


When I change it to >= 4, I still get the values. Are you sure you created the relationship between dimension and fact table correctly?

  • Based on your printscreen of your measure, I assume you replicated my model. I didn’t use an underscore _ in my dimension tables. Since you replicate the model, make sure you replicate it in the exact same way.

One more time I will attach my PBIX file, in which >4 is adjusted to >= 4.

4 or more events Solution DM.pbix (184.4 KB)

If it’s still not fixed after exactly copying my file, send the file again and I will fix it in the file you are using.

Feel free to ask any question about why I modelled the data in this way or how I can help you understand it better.

Pim

@DashboardingMeesters

Pim,

Are u able to create different measure without creating extra tables ( we use here Direct query from Data Warehouse) ?

Your query doesn’t spot all employers unfortunately :frowning:

Iwona

@Iwona

I would love to help, but for that I need more context and explanation.

What do you exactly mean by ‘creating measures without creating extra tables’ of course you can, just add new measure ? This should be possible with direct query if I am correct.

And how do you concluded it didn’t spot all the employers ? Please provide more context / data that support this conclusion, that would improve my ability to assist further.

Hope I don’t sound harsh, just want to help and therefore need to understand the problem first :slight_smile:

Pim

Hi @Iwona, we noticed that no response was received from you with regard to
the post of @DashboardingMeesters

We just want to check if you still need further help with this post.

In case there won’t be any activity on it in the next few days, we’ll be tagging this post as Solved.