The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi guys,
I'm trying to create Measure to count other Measure based on conditions below,
Hi ,
Based on the description, try to create a table that includes the dates you need. Try using the following DAX formula.
Qualified Flag Count =
VAR _ActiveFlag = IF([ActiveFlag] > 0, 1, 0)
VAR _SalesInv = IF([Cumulative Sales] + [Inventory] > 0, 1, 0)
VAR _QualifiedFlag = IF(_ActiveFlag + _SalesInv = 2, 1, 0)
RETURN
SUMX(
CALENDAR(MIN('Table'[Date]), MAX('Table'[Date])),
_QualifiedFlag
)
Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous
it still shows blank, I guess it's because I do not have data rows in source data table for those in June and July month...
Hi @FarhanJeelani ,
Thanks for the advices! I just checked and realized that in June & July, the rows of data does not exist in the source table. Is there any way to fix this?
I used to create table to combine all combination of SKU and month and other data but then it collapsed because the data is too big...
Make since to me also
Hi @cj_oat ,
The issue you’re facing is due to how SUMX works within the row context. The problem arises because _QualifiedFlag is being evaluated in the wrong context when you use SUMX. To resolve this and get the correct results for both individual cells and the totals, you need to make sure the measure respects the context correctly.
Here’s the corrected measure:
Qualified Flag Count = SUMX( 'Table', VAR _ActiveFlag = IF([ActiveFlag] > 0, 1, BLANK()) VAR _SalesInv = IF([Cumulative Sales] + [Inventory] > 0, 1, BLANK()) VAR _QualifiedFlag = IF(_ActiveFlag + _SalesInv = 2, 1, BLANK()) RETURN _QualifiedFlag )
Moving Calculations Inside SUMX:
Ensuring Proper Context:
Check Table Rows:
Let me know if this works!
Please mark this as solution if it helps. Appreciate Kudos.
User | Count |
---|---|
86 | |
84 | |
35 | |
35 | |
34 |
User | Count |
---|---|
94 | |
79 | |
65 | |
55 | |
52 |