The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have a Fact Table with repeating RowID and Entry Date which is linked with Calendar Table. Below is a glimpse of fact table:
One to Many relationship between Calendar, User and Project is already established. I am displaying a Table visual with User Name, Project Name and Unique Count of row_id, Unique Count of row_id for previous month by using calculate-
PreviousMonth =
VAR UniqueRowID = DISTINCTCOUNT(FactTable[`row_id`])
VAR PrevM = CALCULATE(UniqueRowID, PREVIOUSMONTH(FactTable[EntryDate]))
RETURN
PrevM
I am getting the count of Unique Row ID and Previous Month as the same. I don't know where I am going wrong. I also tried with Calculate(UniqueRowID, DATEADD(FactTable[EntryDate],-1,MONTH)) but there's no change in result. Please assist.
Solved! Go to Solution.
Hi @peterpan
Based on your description, you need to use the date of calendar table in previoudmonth() function. you can try the following measure.
PreviousMonth =
VAR PrevM =
CALCULATE (
DISTINCTCOUNT ( FactTable[row_id] ),
PREVIOUSMONTH ( 'Calendar'[Date] )
)
RETURN
PrevM
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @peterpan
Based on your description, you need to use the date of calendar table in previoudmonth() function. you can try the following measure.
PreviousMonth =
VAR PrevM =
CALCULATE (
DISTINCTCOUNT ( FactTable[row_id] ),
PREVIOUSMONTH ( 'Calendar'[Date] )
)
RETURN
PrevM
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @peterpan, give this a try, and if you encounter any issues, let me know.
PreviousMonth =
CALCULATE(
DISTINCTCOUNT(FactTable[row_id]),
PREVIOUSMONTH('Table'[Date])
)
Now PreviousMonth is resulting in completely blank values in Table.
User | Count |
---|---|
75 | |
70 | |
39 | |
30 | |
28 |
User | Count |
---|---|
104 | |
95 | |
51 | |
48 | |
46 |