Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hello,
I am a beginner in Power BI and I have a problem calculating the number of occurrences of measure.
I have 2 problems :
1) I want to know the number of distinct item items I have in measure "Difference Running Total A & B"
Example, in my table , i have 2 article in september 2023. Which formula dax i can do ?
2) I want to know the number of items difference from zero in measure "Difference Running Total A & B"
in my example, i have 2 article with difference running total A&B <>0
My data it's Year, Month, Article and Storage.
I calculate Running total A, Running total B and Difference Running Total A&B in Power bi with measures
Running total A = CALCULATE(
SUM( 'Table'[QuantiteA] ),
FILTER(
ALLSELECTED( 'CALENDAR' ),
'CALENDAR'[Date]
<= MAX('CALENDAR'[Date] )
))
Running total B = CALCULATE(
SUM( 'Table'[Quantite B] ),
FILTER(
ALLSELECTED( 'CALENDAR' ),
'CALENDAR'[Date]
<= MAX('CALENDAR'[Date] )
))
Difference Running Total A&B = [Running total A] - [Running total B]
My data model :
To better understand my problem, I created a pbix file which can be downloaded via One Drive : https://1drv.ms/u/s!AjUN6-w6YnuGz1ng157xR5Ha7h_x
Solved! Go to Solution.
Hi @LLJ1221 ,
Please have a try.
TOTAL_A =
CALCULATE (
COUNT ( 'Table'[QuantiteA] ),
FILTER (
'Table',
'Table'[YEAR_MONTH] = EARLIER ( 'Table'[YEAR_MONTH] )
&& 'Table'[Article] = EARLIER ( 'Table'[Article] )
)
)
TOTAL_b =
CALCULATE (
COUNT ( 'Table'[Quantite B] ),
FILTER (
'Table',
'Table'[YEAR_MONTH] = EARLIER ( 'Table'[YEAR_MONTH] )
&& 'Table'[Article] = EARLIER ( 'Table'[Article] )
&& 'Table'[Quantite B] <> 0
)
)
result = calculate(COUNT('Table'[Article]),FILTER('Table','Table'[TOTAL_A]<>0&&'Table'[TOTAL_b]<>0))
How to Get Your Question Answered Quickly
If I have misunderstood your meaning, please provide more details with your desired output.
Best Regards
Community Support Team _ Rongtie
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
86 | |
84 | |
69 | |
67 | |
55 |
User | Count |
---|---|
125 | |
100 | |
90 | |
84 | |
66 |