Forum Discussion
DAX code for measure not working
- Anonymous4 years ago
Hi ldwf ,
Here are the steps you can follow:
1. Create measure.
Measure = var _min=MINX(ALLSELECTED('Dim Date Table'),[Date]) var _max=MAXX(ALLSELECTED('Dim Date Table'),[Date]) return CALCULATE( MAX('Dim Health Indexes Table'[Health Index]),FILTER(ALL('Dim Health Indexes Table'), 'Dim Health Indexes Table'[Date]=_max))2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi,
Create a Calendar Table with a relationship (Many to One and Single) from the Date column of your Fact table to the Date column of your Calendar Table. In the Calendar Table, create columns for Year, Month name and Month number. Sort the Month name by the Month number. Create slicer for Year and Month name and select a Month and year. To your table visual, drag Country and Date from the Calendar Table. Write this measure
Measure = calculate(sum(Data[Health index]),datesbetween(Calendar[Date],max(calendar[date]),max(calendar[date])))
Hi, thanks for the suggestion. Unfortunately, it doesn't make a difference. I think my DAX formula is almost there, just needs some tweaking. I just want the value from the dimension table that corresponds to the maximum date that is selected in the slicer. I know the joins between the tables are correct so I don't know what hte problem is
- Ashish_Mathur4 years ago
Super User
Hi,
Share the link from where i can download your PBI file.
- ldwf4 years ago
Helper V
Unfortunately, for security reasons, I can't provide the .pbix file