Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hi People,
I am new to power BI. My issue is below: I want to be able to computer the number of interns present in the company using start date and end date and then also be able to filter by units, regions, internship_type, gender etc. Searching in this community, I found a measure able to do that as below (calculating the number present in a month):
number_of_interns_present_count =
VAR endOfPeriod = MAX ( 'DimDate'[Date] )
VAR startOfPeriod = MIN( 'DimDate'[Date] )
RETURN
CALCULATE (
COUNTROWS ( 'internship interns' ),
FILTER (
ALL('internship interns'),
( 'internship interns'[effective_start_date] <= endOfPeriod
&& 'internship interns'[effective_end_date] >= startOfPeriod)
)
)However, my challenge now is that "number_of_interns_present_count" is same for all Units and Regions
Below is my model. Notice that I deactivated the relationship betweem DimDate and Interns effective start date thinking that was the problem but no change. When I am doing a simple count of interns and link DimDate to effective_start_date, I am able to get the number of interns starting in a particular month by Unit and Region when you select a month on the slicer. Please how can I filter by department, unit, gender, internship type etc for this case. For each of these filters the number of interns present is thesame through out. It is not splitted by any of the above.
Solved! Go to Solution.
Hi @Anonymous ,
The DAX query ypu shared can solve the problem computering the number of interns present in the company using start date and end date well. If you want to add the filters, you can change the ALL() function to ALLEXCEPT() function to rule out the units, regions, internship_type, gender.
Best Regards,
Teige
Hi @Anonymous ,
The DAX query ypu shared can solve the problem computering the number of interns present in the company using start date and end date well. If you want to add the filters, you can change the ALL() function to ALLEXCEPT() function to rule out the units, regions, internship_type, gender.
Best Regards,
Teige
Hi @TeigeGao ,
The DAX query gives me the number of interns present correctly. However, my problem now is that it does not distribute the value correctly accross Units, Regions, Gender etc. The value is thesame. See visual below. How can I solve this?
Hi @Anonymous ,
As mentioned in my above reply, you need to use allexcept() function to rule out these filters, because you areusing a all() function in your query, it will remove all filters, then it will display the same value.
Please refer to this blog: https://www.sqlbi.com/articles/using-allexcept-versus-all-and-values/
Best Regards,
Teige
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 55 | |
| 34 | |
| 31 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 74 | |
| 71 | |
| 38 | |
| 35 | |
| 25 |