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.
Hi, I need to create 2 measures (to be inserted in a table) based on a data "Sales" that I currently have for each single month of the current year:
measure 1 - sales from 1 January current year to today's date
measure 2 - sales of the current month only
How can I do?
thanks to who helps me.
Solved! Go to Solution.
@Morgana_2022 do you have a date dimension table?
If yes, then:
measure 0 = SUM('Table'[Sales])
measure 1 = CALCULATE([measure 0], DATESYTD('Date'[Date'))
measure 2 =
VAR _current_month = SELECTEDVALUE('Date'[Month-Year])
RETURN
CALCULATE(
[measure 0],
REMOVEFILTERS('Date'),
'Date'[Month-Year] = _current_month
)
@Morgana_2022 do you have a date dimension table?
If yes, then:
measure 0 = SUM('Table'[Sales])
measure 1 = CALCULATE([measure 0], DATESYTD('Date'[Date'))
measure 2 =
VAR _current_month = SELECTEDVALUE('Date'[Month-Year])
RETURN
CALCULATE(
[measure 0],
REMOVEFILTERS('Date'),
'Date'[Month-Year] = _current_month
)
User | Count |
---|---|
11 | |
9 | |
6 | |
6 | |
5 |
User | Count |
---|---|
23 | |
14 | |
14 | |
9 | |
7 |