The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi Community,
A question for a personal dashboard I have. I am counting calories (yeah, I know) and I got this source calories4 with multiple entries per date. The uniqueness in this source is the piece of food I ate with the number of calories it holds.
For example the month May, in the source this month got 214 entries, which represent the food I ate during the 31 days May knows.
In PowerBI the source is represented as a sum of calories per date.
Today I am trying to visualize the number of days on which I ate less than 2500 calories. The month May has 7 of this kind of days and as I think I need to distinct count the dates which will be 31 in my example and then filter on those which has a sum of less than 2500 but for some reason I can't get this done:
NumOfGreenDays = CALCULATE( DISTINCTCOUNT( calories4[Datum] ), FILTER( calories4, calories4[Calorien] <= 2500 ))
Where am I making the mistake?
Thanks in advance and kind regards,
Aad
Solved! Go to Solution.
Hi @AadFourpoints
Please try
NumOfGreenDays =
SUMX (
VALUES ( calories4[Datum] ),
INT ( CALCULATE ( SUM ( calories4[Calorien] ) ) <= 2500 )
)
Both thanks for replying this quick! The solution Tamerj1 posted works like a charm! And thanks Some_big, I see the datetime format and that is a bit overkill *grin*
Thanks alot and kind regards,
Aad
Hi @AadFourpoints
Please try
NumOfGreenDays =
SUMX (
VALUES ( calories4[Datum] ),
INT ( CALCULATE ( SUM ( calories4[Calorien] ) ) <= 2500 )
)
Hi @AadFourpoints try to format your Datum colum as type date in Power Query step during import.
Proud to be a Super User!
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
18 | |
18 | |
17 | |
15 | |
13 |
User | Count |
---|---|
36 | |
35 | |
19 | |
18 | |
18 |