Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Happy August-ing developers
Some help from whom can lend an ear
I have table A. showing entries data by created date
I have table B. showing historic performance per specific dates
The two date columns have a relationship
My DAX calclulated values are definitely not correct. Any ideas?
B. Pefromance dates
Solved! Go to Solution.
Hi @Mike_Mace,
My formula is a measure please create a measure and copy the code into measure expression to use it:
Entries New/week test 2=
VAR currDate =
MAX ( 'Performance Table'[Dates] )
RETURN
CALCULATE (
COUNTROWS ( 'Entries Table' ),
FILTER (
ALLSELECTED ( 'Entries Table'),
YEAR ( [Created]) = YEAR ( currDate )
&& WEEKNUM ( [Created] ) = WEEKNUM ( currDate )
)
)
If you want a calculated column version, you can try to use following calculated column formula: (Notice: calculated column/table did not dynamic changes based on filters/slicers)
Entries New/week test 2 =
CALCULATE (
COUNTROWS ( 'Entries Table' ),
FILTER (
ALLSELECTED ( 'Entries Table' ),
YEAR ( [Created] ) = YEAR ( EARLIER ( 'Performance Table'[Dates] ) )
&& WEEKNUM ( [Created] ) = WEEKNUM ( EARLIER ( 'Performance Table'[Dates] ) )
)
)
Regards,
Xiaoxin Sheng
Hi @Mike_Mace,
I'd like to suggest you use year and weeknum to filter and calculated the records:
formual =
VAR currDate =
MAX ( Performance[Date] )
RETURN
CALCULATE (
COUNTROWS ( 'Entries table' ),
FILTER (
ALLSELECTED ( 'Entries table' ),
YEAR ( [Created] ) = YEAR ( currDate )
&& WEEKNUM ( [Created] ) = WEEKNUM ( currDate )
)
)
If the above not help, please provide more detailed information to help us clarify your requirement.
Regards,
Xiaoxin Sheng
Hi @v-shex-msft ,
Attaching the pbix on a wetranfer link as my first message was not accurate enough to pass on the query.
I've removed the relationship between the two datasets and the original formula to calculate all the entries per said week (on performance dataset) seems to work BUT the value for the latest date is not calculated.
I've manually checked the numbers from the spreadsheet side for that week to be 864 but see on snip it is left empty.
Does formula need another filter?
I've crosschecked another two weeks by checking the number of entries from the spreadsheet manually and the numbers are correct
Entries /week column = CALCULATE(COUNTROWS('Entries table'), DATESINPERIOD('Entries table'[Created], Performance[Date], -7, DAY))
Hi @Mike_Mace,
Can you please upload this to onedrive for business? I can't download from the third party web drive that you shared.
Regards,
Xiaoxin Sheng
Here, copying link to onedrive
HI @Mike_Mace,
Shared content seems to be removed when I access to your link, can you please fix this?
Regards,
Xiaoxin Sheng
Hi @v-shex-msft ,
Of course, here's the right link for it
https://1drv.ms/u/s!Amf63tQXGj5rklkr-5wKw8XgwEK1
Hi @Mike_Mace,
My formula is a measure please create a measure and copy the code into measure expression to use it:
Entries New/week test 2=
VAR currDate =
MAX ( 'Performance Table'[Dates] )
RETURN
CALCULATE (
COUNTROWS ( 'Entries Table' ),
FILTER (
ALLSELECTED ( 'Entries Table'),
YEAR ( [Created]) = YEAR ( currDate )
&& WEEKNUM ( [Created] ) = WEEKNUM ( currDate )
)
)
If you want a calculated column version, you can try to use following calculated column formula: (Notice: calculated column/table did not dynamic changes based on filters/slicers)
Entries New/week test 2 =
CALCULATE (
COUNTROWS ( 'Entries Table' ),
FILTER (
ALLSELECTED ( 'Entries Table' ),
YEAR ( [Created] ) = YEAR ( EARLIER ( 'Performance Table'[Dates] ) )
&& WEEKNUM ( [Created] ) = WEEKNUM ( EARLIER ( 'Performance Table'[Dates] ) )
)
)
Regards,
Xiaoxin Sheng
@Mike_Mace - You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000
Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...
Otherwise, Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882
Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
@Mike_Mace , Not very clear.
For week vs week check - With date table and week rank
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
how to create week on your choice https://community.powerbi.com/t5/Community-Blog/Any-Weekday-Week-Decoding-Date-and-Calendar-2-5-Powe...
User | Count |
---|---|
139 | |
113 | |
104 | |
77 | |
63 |
User | Count |
---|---|
135 | |
126 | |
110 | |
70 | |
61 |