March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi ALL.
i'm doing measure calculation with custom group of columns for sales amount and purchase amount from single table
1st variable does calculate sum of salesamount for 5 of columns.
2nd variable does calculate sum of purchase amont for same 5 columns.
3rd variable does %margin calculation (sales/profit).
now my requirement i want distinct count of employees with margin % between >5% and <90% from the above groupby column combination only because of data structures. so can i same filter condition in same variance measure.?
Variance =
VAR _sales = GROUPBY(TableX, State, City, Product, EmployeeID, Date,"Sales", SUMX(CURRENTGROUP(), [SalesAmount))
VAR _Profit = GROUPBY(TableX, State, City, Product, EmployeeID, Date,"Purchase", SUMX(CURRENTGROUP(), [PurchaseAmount))
Var _Margin =Divide( CALCULATE(SUMX(_Sales,[SalesAmount]),ALLEXCEPT(TableX, [DATE])) , CALCULATE(SUMX(_Profit,[PurchaseAmount]),ALLEXCEPT(TableX,[DATE])))
return _Margin.
I tried doing new calcuation on top of [Variance] Measure didnt work well either some ws are missing data is not accurate or outer filters not applying within measure scondition,Much appreciated for help 🙂
file attachment
IF ( [Variance] < 90 ,CALCULATE ( DISTINCTCOUNT ( TableX[EmployeeID]), FILTER ( ALL ( 'TableX' ), [Variance] < 1 )),0 )
Solved! Go to Solution.
Hi,
Going by your description, this measure should work
=countrows(filter(values(TableX[EmployeeID]),[Margin]>0.05&&[Margin]<0.90))
Hope this helps.
Hi,
Going by your description, this measure should work
=countrows(filter(values(TableX[EmployeeID]),[Margin]>0.05&&[Margin]<0.90))
Hope this helps.
expression worked for 85% of data. but i figured we have to apply filter expression on both variable sales & purchase after group by condition to drop rows with 0 amount values. then your provided filter should work 100%
You marked my response as Answer. So has my formulas resolved your problem?
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
89 | |
84 | |
70 | |
51 |
User | Count |
---|---|
206 | |
143 | |
97 | |
79 | |
68 |